users@jersey.java.net

Re: [Jersey] Accessing POST body ?

From: Srinivas Naresh Bhimisetty <Srinivas.Bhimisetty_at_Sun.COM>
Date: Tue, 25 Nov 2008 12:41:04 +0530

I'm sorry for the duplication. There was some issue with the mail server
here, so I thought the first mail wasn't sent.

-Naresh

Srinivas Naresh Bhimisetty wrote:
> Hi Arun,
>
> the POSTed data could be accessed in the resource method by
> annotating it with the @Consumes annotation.
> The method needs to be annotated with @Consumes(mime-type) and should
> have a parameter matching the mime-type. Jersey then gets the POSTed
> data to this method parameter.
>
> It would be something like this:
> ----------------------------------------------------------------------------------------
>
> @POST
> @Consumes("text/plain")
> public String doSomething(String postedData) {....}
> -----------------------------------------------------------------------------------------
>
>
> -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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>