users@jersey.java.net

Re: [Jersey] Take 2: Using MessageBodyWriters as Providers for an AccountList and an Account object

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 03 Nov 2008 08:43:52 +0100

On Oct 31, 2008, at 9:12 PM, John O'Conner wrote:

> On Fri, Oct 31, 2008 at 11:31 AM, Paul Sandoz <Paul.Sandoz_at_sun.com>
> wrote:
>>
>> I suspect the servlet web container is creating a default error
>> page because
>> there is no entity built in the response.
>>
>>
>
> Should I always return something in the entity field of a Response? In
> my case, I try to retrieve the resource, and if it doesn't exist I'm
> just returning a null object.
>

Only unless you need to, from the perspective of how you want to write
the application. For the case of something not found it may be
preferable to throw an exception and map it, see next paragraph.


> For now I think I'll try to find out if the servlet container has
> defined a "default" 404 handler...which is what I think you're
> suggesting.
>

Yes.

Do you know about ExceptonMapper [1] ?

Paul.

[1] https://jsr311.dev.java.net/nonav/releases/1.0/javax/ws/rs/ext/ExceptionMapper.html


> --
> John
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>