com.yammer.dropwizard.jersey.DropwizardResourceConfig Maven / Gradle / Ivy
package com.yammer.dropwizard.jersey;
import com.sun.jersey.api.core.DefaultResourceConfig;
import com.sun.jersey.api.core.ResourceConfig;
import com.yammer.dropwizard.jersey.caching.CacheControlledResourceMethodDispatchAdapter;
import com.yammer.metrics.jersey.InstrumentedResourceMethodDispatchAdapter;
public class DropwizardResourceConfig extends DefaultResourceConfig {
public DropwizardResourceConfig(boolean testOnly) {
super();
getFeatures().put(ResourceConfig.FEATURE_DISABLE_WADL, Boolean.TRUE);
if (!testOnly) {
// create a subclass to pin it to Throwable
getSingletons().add(new LoggingExceptionMapper() {});
getSingletons().add(new InvalidEntityExceptionMapper());
getSingletons().add(new JsonProcessingExceptionMapper());
}
getClasses().add(InstrumentedResourceMethodDispatchAdapter.class);
getClasses().add(CacheControlledResourceMethodDispatchAdapter.class);
}
}