users@jersey.java.net

[Jersey] Re: Accessing MesgBody in Jersey

From: Martin Matula <martin.matula_at_oracle.com>
Date: Fri, 25 Feb 2011 10:14:44 +0100

Hi Arthur,
Message body is passed to a parameter of the post method (depending on
the parameter type, media type the method consumes and availability of
the corresponding MessageBodyReader).
Simple example:

@POST
@Consumes("text/plain")
public Response postIt(String messageBody) {
     ....
     return Response.ok().build();
}

Regards,
Martin

On 24.2.2011 22:57, Arthur Yeo wrote:
> All,
>
> What are the best practices approaches to access the Message Body when
> servicing a RESTful request?
> Are there some sample code around that shows this?
>
> E.g.
> The RESTful client sends a POST request with a Message Body.
> What's the best way to access that body content over on the RESTful
> Server side.
>
> --
> Arthur Y.