users@jersey.java.net

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

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 18 Jun 2009 08:24:31 +0200

On Jun 18, 2009, at 7:56 AM, Tatu Saloranta wrote:

> 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.
>

+1

Jersey has filters:

   https://jersey.dev.java.net/nonav/apidocs/1.1.0-ea/jersey/com/sun/jersey/api/container/filter/package-summary.html

you can apply then to the app or specially to resources.


> 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.

Are there any aspects to what you are doing that we could make easier?

Paul.

>
> Similarly for output, wrapping response object in StreamingOutput
> works well, if I need to tweak output process or catch specific
> processing problems.
>
> -+ Tatu +-
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>