users@jersey.java.net

Re[Jersey] ading entity body

From: Gili <cowwoc_at_bbs.darktech.org>
Date: Wed, 22 Oct 2008 16:39:46 -0700 (PDT)

So... hmm... this feels like a dumb question, but how am I supposed to read
the entity body? I know you use MessageBodyReader/Writer to read/write Java
classes into the body but I don't think this is what I'm looking for.

I want to read some XML from the body of a HTTP POST and based on its
content I will either create a new database entry or update an existing
entry. The xml doesn't necessarily have to provide all fields (i.e. if
you're renaming an existing database entry).

Am I supposed to use @Context HttpServerRequest and read the InputStream
that way?

Also, how is MessageBodyReader supposed to know what class type is on the
stream before actually consuming that stream? Does JAX-RS write something
proprietary onto the HTTP headers or body to this end or is the Provider in
full control of what's getting written? Doesn't this mechanism assume that
servers and clients will share the same MessageBodyReader/Writer
implementation? Is there such a thing as a JAX-RS client (I was under the
impression JAX-RS only defines server-end stuff)?

Thanks,
Gili
-- 
View this message in context: http://n2.nabble.com/Reading-entity-body-tp1366219p1366219.html
Sent from the Jersey mailing list archive at Nabble.com.