users@jersey.java.net

Re: [Jersey] Whats the best way to get the raw input before jersey server binds them into java objects

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Wed, 17 Jun 2009 22:56:06 -0700

On Wed, Jun 17, 2009 at 6:44 PM, Jason Wang<jason.wang_at_bulletin.net> wrote:
> Hi all,
>
> I am using Jersey server and client to develop our restful webapp. It worked
> quite nicely.
> I got one question which has bugged me for a bit time:
>
> Whats the best way to get the raw input before jersey server binds them into
> java objects?

I think it'd be easier to answer this, if you could explain the use case.

But what I generally do is to just take in InputStream, and invoke
binding explicitly (using JAXB for xml, Jackson for JSON), similar to
how I suspect Jersey does. For me the reason to do this is to add some
more error handling, as I can add problem listeners to data binders
and such.
Similarly for output, wrapping response object in StreamingOutput
works well, if I need to tweak output process or catch specific
processing problems.

-+ Tatu +-