I’m using jersey API for some REST web services with apache Tomcat. I need to pass more than one parameter to a method so I decided to use @QueryParam annotation like this :
@GET
@Path("/date")
@Produces(MediaType.APPLICATION_JSON)
public Response getDate(@QueryParam("id") String Id, @QueryParam("inDate") String inDate)
{
...
}
when I call it like this everything works. But when I use annotaitions @POST or @PUT instead of @GET then it shows an error:
HTTP Status 405 – Method Not Allowed
message Method Not Allowed
description The specified HTTP method is not allowed for the requested
resource (Method Not Allowed).
Is it possible to user this with POST or PUT and how?
Any help is appreciated.
Yes, you just need to make the request using POST or PUT. This can’t be done via the URL – you’d need a specific client (for example the http resource firefox plugin) that can send requests with methods other than GET. Note that for POST you can also use
@FormParam