users@glassfish.java.net

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

From: <glassfish_at_javadesktop.org>
Date: Tue, 12 Jan 2010 06:25:05 PST

> Check out the javax.ws.rs.ext.ExceptionMapper
> interface.

Thank you. I spent some time looking at this interface and don't think it will change anything for me. It looks like I would create an exception mapper if I wanted JAX-RS to know about an existing exception in my application. I am throwing an exception that extends WebApplicationException, and the constructor does the same thing as the example code in the Jersey documentation.

I don't think the problem is Jersey or JAX-RS. I think when GlassFish sees an application returning an HTTP error code, it first looks to see if the application has defined error pages to display. If not, then it displays its own error pages. This is undesirable for REST APIs since it totally rewrites the headers and body. The only way I could find to get around it is to make sure I output an entity body when returning an error. Then GlassFish seems to let it through.

I've been doing my testing using the REST features in SoapUi.


Thanks,
Ryan
[Message sent by forum member 'rdelaplante' (ryan_at_ijws.com)]

http://forums.java.net/jive/thread.jspa?messageID=380301