I am using Jersey 2.3.1 on Glassfish 4.
My resource method is similar to the following:
@POST
@Consumes("application/x-www-form-urlencoded")
@Path("/update")
public Response update(MultivaluedMap<String, String> formParams){
//business logic
//return appropriate Response object
}
I always get formParams.size()
as zero. Why the submitted form parameters are not available in the MultivaluedMap
object?
The following warning message in the server log:
WARNING: A servlet request to the URI http://localhost:8080/myApp/resource/update
contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected.
(I tested before and after disabling all Servlet filters. I am not using any Jersey filters)