Open
Description
I recognized that we're not specifying exception handling in MVC applications or, at least, how the existing approaches shall be used. In my opinion, we should add some section about how MVC implementations should handle the response from jakarta.ws.rs.ext.ExceptionMapper
implementations, because at the moment there is the need to use Krazo-specific API (Viewable
).
@Provider
@Priority(Interceptor.Priority.APPLICATION + 999)
public class GeneralExceptionMapper implements ExceptionMapper<Exception> {
@Override
public Response toResponse(final Exception exception) {
return Response.serverError().entity(new org.eclipse.krazo.engine.Viewable("serverError.jsp")).build();
}
}
I think the implementations should ensure, that we can return the same values as in @Controller
annotated resources, so we have a consistent and clear behavior. The example posted above would then look like this:
@Provider
@Priority(Interceptor.Priority.APPLICATION + 999)
public class GeneralExceptionMapper implements ExceptionMapper<Exception> {
@Override
public Response toResponse(final Exception exception) {
return Response.serverError().entity("serverError.jsp").build();
}
}
Please add your feedback or possible Jakarta REST limitations which I'm not aware of.
Metadata
Metadata
Assignees
Labels
No labels