The first step is to configure Jersey to allow this:
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.PostReplaceFilter</param-value>
</init-param>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):Ext.Ajax.request({
headers : {
'X-HTTP-Method-Override' : 'PUT'
},
method: 'POST',
url: '/my-api/some-service',
params: {
name : someObj.name,
date : someObj.date,
amount : someObj.amount
},
success: this.onSaveSuccess.createDelegate(this),
failure: this.onSaveFailure.createDelegate(this)
});
1 comment:
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!!!
Post a Comment