users@jersey.java.net

Re: [Jersey] how to catch 405 errors.

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 21 Apr 2010 16:51:06 +0200

Hi Diego,

Some questions:

1) What version of Jersey are you using?

2) Are you deploying as a servlet?

When you say custom format do you mean returning some HTML as response
entity or some XML or JSON?

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.

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
>