I did it using a ExceptionMapper:
package com.perfectprintpattern.service.exception.handling;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import com.perfectprintpattern.service.exception.customError.CustomErrorException;
@Provider
public class CustomExceptionMapper implements
ExceptionMapper<CustomErrorException> {
@Context
protected HttpServletRequest request;
public Response toResponse(CustomErrorException exception) {
this.request.setAttribute("javax.servlet.jsp.jspException", exception);
return Response.status(exception.getStatus()).build();
}
}
works great!!!
-----Ursprüngliche Nachricht-----
An:users_at_jersey.java.net;
Von:Lukas Lentner <kontakt_at_lukaslentner.de>
Gesendet:Mi 12.10.2011 18:57
Betreff:[Jersey] could not be mapped to a response, re-throwing to the HTTP container
Hi,
when I fire a MyException extending RuntimeException it properly gets mapped to the JSP I defined for MyException via error-page in the web.xml.
This Exception gets handled properly! Why do I see the error in the subject in the eclipse IDE???
It's not wrong that it is mapped that way?
Lukas