users@glassfish.java.net

Re: JAX-RS error code 500 = GlassFish HTML error page

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Fri, 15 Jan 2010 10:23:37 -0800

Paul,

On 01/15/10 02:40 AM, Paul Sandoz wrote:
> On Jan 15, 2010, at 8:45 AM, Markus Karg wrote:
>
>> Sounds like a patch but not like a solution. People want
>> out-of-the-box Java EE correctness, not patches. At least me. ;-)
>>
>
> I think we are progressing to a good solution.
>
> Since, as i understand this, the default error page support is
> implementation specific feature then for Jersey we might be able to
> set a GF specific property on deployment via code. Jan, do you know if
> that would be possible per servlet?

If we wanted to configure this on a per-servlet basis, one idea would be to
leverage servlet init parameters.

When Jersey's ServletContainerInitializer registers a Jersey integration
servlet,
it would also specify this init parameter.

In case of an error, the web container could check if the target servlet
to which
the request was mapped was configured with this init parameter, and disable
the default error page accordingly.

This solution would not require any new property in sun-web.xml.

What do you think?

Jan

>
> Paul.
>
>>
>> *From:* Jan.Luehe_at_Sun.COM <mailto:Jan.Luehe_at_Sun.COM>
>> [mailto:Jan.Luehe_at_Sun.COM]
>> *Sent:* Freitag, 15. Januar 2010 01:18
>> *To:* users_at_glassfish.dev.java.net <mailto:users_at_glassfish.dev.java.net>
>> *Subject:* Re: JAX-RS error code 500 = GlassFish HTML error page
>>
>> On 01/14/10 03:21 PM, glassfish_at_javadesktop.org
>> <mailto:glassfish_at_javadesktop.org> wrote:
>> What about when I configure custom error pages for 404, 500, etc. because my .war file contains a website, but the JAX-RS API in the same .war file needs to return 404 and 500 error codes? The custom error page should not be sent in the JAX-RS API responses. I don't have a good solution to offer.
>>
>>
>> This goes back to your original question:
>>
>> How can I make GlassFish use custom error pages for all URI's that
>> do not start with /rest/ ?
>>
>> Perhaps the new configuration in sun-web.xml that will be used
>> to disable the default error page could specify a comma-separated
>> list of request url-patterns (path prefices) as its value. An empty list
>> would disable the default error page for the entire application.
>>
>> Jan
>>
>>
>>
>>
>>
>>
>>
>>
>> I like your suggestion of allowing to disable the
>>
>> default error page
>>
>> on a per-application basis via some configuration in
>>
>> sun-web.xml, and have
>>
>> reopened
>>
>> https://glassfish.dev.java.net/issues/show_bug.cgi?id=
>>
>> 11423
>>
>> (the issue
>>
>> that Ryan had filed) so that it can be fixed
>>
>> accordingly.
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Jan
>>
>>
>>
>> [Message sent by forum member 'rdelaplante' (ryan_at_ijws.com <mailto:ryan_at_ijws.com>)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=381037
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net <mailto:users-unsubscribe_at_glassfish.dev.java.net>
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net <mailto:users-help_at_glassfish.dev.java.net>
>>
>>
>>
>