How do I register my provider programmatically in jersey which implements the Exceptionmapper provided by jersey API? I don\'t want to use @Provider annotation and want to r
I'm guessing you don't have a ResourceConfig, since you seem to not be sure how to use it. For one, it is not required. If you do use it, it should be it's own separate class. There you can register the mapper.
public class AppConfig extends ResourceConfig {
public AppConfig() {
register(new MyProvider());
}
}
But you are probably using a web.xml. In which case, you can register the provider, with the following
MyApplication
org.glassfish.jersey.servlet.ServletContainer
jersey.config.server.provider.classnames
org.foo.providers.MyProvider
Have a look at Application Deployment and Runtime Environments for more information on different deployment models. There are a few different ways to deploy applications. You can even mix and match (web.xml and ResourceConfig).