Saturday, March 6, 2010

Tunneling PUT and DELETE from ExtJS to Jersey ReST

Here is how you can invoke AJAX POSTs in ExtJS that map to PUT and/or DELETE methods in your Jersey ReST services.

The first step is to configure Jersey to allow this:
The next step is to issue the AJAX request (in this case we're going to issue a POST but tell Jersey to invoke the PUT mapped method instead):
    headers : {
        'X-HTTP-Method-Override' : 'PUT'
    method: 'POST',
    url: '/my-api/some-service',
    params: {
        name :,
        date :,
        amount : someObj.amount
    success: this.onSaveSuccess.createDelegate(this),
    failure: this.onSaveFailure.createDelegate(this)

1 comment:

Jim Bikas said...

Thanks a lot RUSS!!
I was trying to implement an Ext ajax request with PUT and DELETE methods with csrf-token as a param without success for a month..
Thanks again!!!