users@jersey.java.net

Re: Re[Jersey] ading entity body

From: Gili <cowwoc_at_bbs.darktech.org>
Date: Thu, 23 Oct 2008 07:41:54 -0700 (PDT)

Paul Sandoz wrote:
>
> What XML API do you want to use?
>

XOM or dom4j.


Paul Sandoz wrote:
>
> You want to use POST for partial update?
>

Actually I was going to use PUT for both partial and full updates.


Paul Sandoz wrote:
>
> You can just use InputStream directly.
>
> @POST void post(InputStream in) { ... }
>
> Or you can use JAXB, or DOM:
>
> @POST void post(javax.xml.transform.dom.DOMSource ds) { ...
>

That's very cool :) Where can I find a list of the kinds of parameters I can
expect JAX-RS or Jersey to provide auto-magically? :)


Paul Sandoz wrote:
>
>> 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?
>
> No. The application developer is in control of the Java type and media
> type, which results in the selection of the most appropriate
> MessageBodyReader.
>

How does a MessageBodyReader indicate it can parse a certain InputStream
without consuming it in the process of checking? :) The only way I can think
of is using the headers or media type. Is there another way?


Paul Sandoz wrote:
>
>> Doesn't this mechanism assume that
>> servers and clients will share the same MessageBodyReader/Writer
>> implementation?
>
> No.
>

So I'm not sure I understand how this is supposed to work. If the server is
using MessageBodyWriter to encode a Java object, doesn't the client need to
know how to decode it? Are you saying it doesn't need to know anything about
MessageBodyReader/Writer so long as it understands the format produced by
the server's MessageBodyWriter?

> Is there such a thing as a JAX-RS client (I was under the
> impression JAX-RS only defines server-end stuff)?
>


Paul Sandoz wrote:
>
> JAX-RS is only server-side. Jersey defines a client-side, that reuses
> message body readers/writers:
>
> https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0/api/jersey/com/sun/jersey/api/client/package-summary.html
>

Excellent, thanks! :)

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