Note that there are some explanatory texts on larger screens.

plurals
  1. POProcess parameters of a POST HTTP request in a REST web service (JERSEY)
    primarykey
    data
    text
    <p>I'm developing a rest web service on GAE. I'm using Jersey framework to implement the services. It is a POST service where I have to pass also parameters. I tried to use 2 types of annotation but I can't get the parameters:</p> <p>@Context</p> <pre><code>@POST @Path("add") @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Notification addUser(@Context UriInfo uriInfo){ MultivaluedMap&lt;String, String&gt; queryParams = uriInfo.getQueryParameters(); String nickname = queryParams.getFirst("nickname"); String name = queryParams.getFirst("name"); String surname = queryParams.getFirst("surname"); String telephone = queryParams.getFirst("telephone"); String email = queryParams.getFirst("email"); User =createUser(nickname, name, surname, telephone, email); ....... } </code></pre> <p>@QueryParam</p> <pre><code>@POST @Path("add") @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Notification addUser(@QueryParam("nickname") String nickname, @QueryParam("name") String name, @QueryParam("surname") String surname, @QueryParam("telephone") String telephone, @QueryParam("email") String email) { User =createUser(nickname, name, surname, telephone, email); ...... } </code></pre> <p>But in both cases I can not get the parameters all of them are null values.</p> <p>this is an example of my http request:</p> <pre><code>Request URL: http://windyser.appspot.com/rest/users/add Request Method: POST Params: {"nickname":"prova","name":"danilo","surname":"delizia","email":"prova@yahoo.it","telephone":"123"} Sent Headers Accept: */* Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Accept-Language: en </code></pre> <p>Anybody know if I'm missing something?</p> <p>Thanks in advance for your help</p> <p>Danilo</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload