Question is below in bold.
I have a PUT method in my jax-rs which is the following code:
@PUT
@Path("{id}/url.json")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public ResponseEntity dealRedeemed(@PathParam("id") long id,
@FormParam("lat") long lat,
@FormParam("lng") long lng) {
ResponseEntity entity = new ResponseEntity();
entity.addField("lat", lat); // THIS WORKS WHEN POSTING FROM A FORM
entity.addField("lng", lng); // THIS WORKS WHEN POSTING FROM A FORM
return entity;
}
I am calling it from Android using:
AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.put("lat", latitude);
params.put("lon", longitude);
client.put(getAbsoluteUrl(id+"/url.json"), params, responseHandler);
How can I access the params in JAX-RS when the PUT method is called via Android? If I were to use a HTML form to call this method, it works fine. I the response I get when calling this from an android device is:
HTTP Status 400 - Bad Request : The request sent by the client was syntactically incorrect.
Any help in the right direction would be greatly appreciated. Thanks!