users@jersey.java.net

Re: Mapping error status codes to resources

From: Alexandru Popescu ☀ <the.mindstorm.mailinglist_at_gmail.com>
Date: Fri, 30 Jul 2010 16:41:23 +0300

Upon further (re)search it looks like most of the posters talking
about a similar solution are solving it by using exceptions and
ExceptionMapper.

Probably because I hate programming through exception, I've thought
about a different approach based on container response filters.
Basically, using a special container response filter would allow me to
customize both the Response and the Entity according to the app needs.

Is this the right direction?

:- alex


2010/7/30 Alexandru Popescu ☀ <the.mindstorm.mailinglist_at_gmail.com>:
> Hi,
>
> I was wondering if there is any way I can map error status codes to
> special resources that are able to return a more useful/friendlier
> responses?
>
> Basically what I want to achieve is that for any resource returning
> say a 404, I could intercept this and provide a better/friendlier
> response. A good example would be to provide a better looking 404 page
> for text/html requests.
>
> I've read about the ExceptionMapper and this seems to be good for
> dealing with exceptions, but not with statuses.
>
> Am I looking in the right direction or are there better ways to deal with this?
>
> many thanks in advance,
>
> :- alex
>