I've created class that implements implements ExceptionMapper<WebApplicationException>
and registered it by environment.addProvider(new WebApplicationExceptionMapper());
. My custom mapper works but only for some exceptions extended from WebApplicationException
. For example it doesn't work for ConflictException
and it also doesn't work for my custom exceptions with following constructor:
public ConflictException(URI location, Object entity) {
super(Response.status(Response.Status.CONFLICT).location(location).entity(entity).build());
}
It will work if I'll remove super(Response.status....
. This is very strange and I can't explain this. I'm not sure is it Jersey
or Dropwizard
behaviour.
What is correct way to configure mapper for all WebApplicationException
and subclasses? Can you explain problems that I have?