Typically one uses ExceptionMapper
to catch exceptions, log them, return a customized error messages.
However while JAX-RS provides an NotFoundException
in its api, the implementations (Jeresy, CXF,...) provide their own NotFoundException (such as com.sun.jersey.api.NotFoundException
) which doesn't extends the JAX-RS one.
Leaving us with the sole option of having in our code implementation specific imports. This makes it hard if one wants to switch implementations.
Is there another way to do this, to avoid the dependency on a specific implementation?