users@jersey.java.net

Re: [Jersey] Accessing POST body ?

From: Srinivas Naresh Bhimisetty <Srinivas.Bhimisetty_at_Sun.COM>
Date: Tue, 25 Nov 2008 10:32:33 +0530

Hi Arun,

   the POSTed data could be accessed in a resource by just annotating
the POST method with a @Consumes annotation. All that we need to do is
just set the mime-type of the posted data in the Consumes annotation,
and add a resource method parameter of that type.

Something like:
---------------------------------------------------
@POST
@Consumes("text/plain")
public String doSomething(String postData) {...}
---------------------------------------------------

-Naresh


Arun Gupta wrote:
> POSTing a request using client APIs as:
>
> ClientResponse cr = resource.
> type("text/plain").
> post(ClientResponse.class, "some stuff");
>
> How do I access "some stuff" in a method on my resource ?
>
> -Arun