Resteasy in-built exceptions not caught in the exception mapper
932222Apr 21 2012 — edited Apr 21 2012Hi friends,
I have written some exception mappers to catch and handle the in-built rest easy exceptions like NotFoundException,MethodNotAllowedException, etc., Sample code as shown:
@Provider
public class NotFoundExceptionMapper implements ExceptionMapper<org.jboss.resteasy.spi.NotFoundExc eption>
{
@Override
Response toResponse(org.jboss.resteasy.spi.NotFoundExceptio n exception) {
return Response.status(500).build();
}
}
I have also written a try catch block in my web filter class. Whenever a NotFoundException occurs, it is not caught in the mapper, but it goes to the catch block in the Filter.
Whereas I have tried another exception mapper class to handle JsonParsingException. This is working correctly and giving a proper response from the mapper whenever a Json Parse exception occurs.
The issue is only with the case of resteasy inbuilt exceptions.
Also, the Provider has been registered in the application context using the include-filter tag inside component scan.
Is there any additional configuration to be done for this?
Please guide me as to what needs to be done to catch rest easy in-built exceptions in the mapper class itself.
Regards,
RM