On Sep 10, 2010, at 12:57 AM, John Lister wrote:
> Maybe I'm doing something crazy and misunderstood exception mappers,
> but I'm trying to do this in the toResponse function of my exception
> mapper
>
> return Response.status(statusCode).entity(errorText).type("text/
> html").build();
>
> which seems to work in that the response is returned and rendered as
> html, for example, but the status code returned is alwasy OK (200).
>
> is this expected and i've missed something?
>
No, it is not expected. The status code returned should be that set by
the Response.status(statusCode). Do you have a reproducible test case
you can send me?
The setting of a Response instances via exceptions is fundamental to
the way Jersey returns 4xx responses. If you perform a GET on a URL
you know does not exist (from within the Jersey URL space) does that
return a 404 status code?
Paul.
> Essentially I've added a statuscode to my exception class rather
> than defining multiple error page handlers in web.xml...
>
> This is with glassfish 3.0.1 and jersey 1.4.04 (I've tried a newer
> version but some deployment errors - see other email
>
> Thanks
>
>
>
> John
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>