I'm trying to get request params passed by PUT request, at Grails-based app.
I'm using following client code to make request:
$.ajax({
url: 'api/controllerName/anId',
type: 'PUT',
data: $('form').serialize()
})
with following mapping:
"/api/$controller/$id?" {
action = [ GET: "read", POST: "create", PUT: "update", DELETE: "delete"]
}
But my controller's action receives empty params list, with only id value. I tried to put it content to logs and saw only:
[id:anId, action:[GET:read, POST:create, PUT:update, DELETE:delete], controller:controllerName]
and request.getParameterNames()
returns empty list of values.
As I see from FireBug, request contains this params, and have Content-Type as application/x-www-form-urlencoded; charset=UTF-8
If I'm using GET/POST method - everything is working as expected, I can get all passed parameters.
How I can get access to passed parameters?
Update: I've just figured that PUT implies passing data as JSON/XML in body. Btw, this question is still actual, just in case