Closed elandau closed 10 years ago
Generic Jersey ExceptionMapper with Guice based plugin architecture to allow for context based default exception mapping.
Here's how to add a custom default mapper MyExceptionMapper
new JerseyServletModule() { @Override protected void configureServlets() { Multibinder<CustomThrowableExceptionMapper> mappers = Multibinder.newSetBinder(binder(), CustomThrowableExceptionMapper.class); mappers.addBinding().to(MyExceptionMapper.class); Map<String, String> params = new HashMap<String, String>(); params.put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.netflix.jersey.guice.providers.exception;"); serve("/*").with(GuiceContainer.class, params); binder().bind(GuiceContainer.class).asEagerSingleton(); } }
Generic Jersey ExceptionMapper with Guice based plugin
architecture to allow for context based default exception mapping.
Here's how to add a custom default mapper MyExceptionMapper