On Wed, 2010-04-21 at 16:51 +0200, Paul Sandoz wrote:
> Hi Diego,
>
> Some questions:
>
> 1) What version of Jersey are you using?
>
1.1.5
> 2) Are you deploying as a servlet?
Yes.
> When you say custom format do you mean returning some HTML as response
> entity or some XML or JSON?
>
The requirement is to return error responses as XML. We handle all, data
and errors as XML entities. We already do with the exceptions thrown in
our code. We are trying to figure out how to catch exceptions thrown in
Jersey, at the beginning of the request. F.i., when the client
application send a String id as path parameter when we expect a Long id.
In that case a 404 error (html format) is returned. We would like to
return some XML response.
> You can use an exception mapper for WebApplicatio, check the Response
> from that exception and then create a new response as appropriate or
> return the existing response.
>
There is any example ?. One of my coworkers is playing with
ExceptionMapper, without too much luck until now.
> Paul.
>
> On Apr 21, 2010, at 4:43 PM, Diego Gil wrote:
>
> > Hi,
> >
> > We are developing a small web services repository with Jersey and
> > facing
> > now a little issue with error messages.
> >
> > If the client makes a wrong request, calling a non existing method due
> > to a typo, gets a 405 response. That is ok but we would like to catch
> > this exception to use a custom format.
> >
> > There is any example of that ?.
> >
> > We should use ExceptionMapper or there is another hook to catch that
> > early errors?
> >
> > Thanks,
> > Diego.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>