Through the environment class.
https://dropwizard.imtqy.com/dropwizard/manual/core.html#environments
@Override
public void run(MyApplicationConfiguration configuration, Environment environment) {
environment.servlets().addFilter("Custom-Filter-Name", new MyCustomFilter()).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}
You can select sending types by changing EnumSet.allOf(DispatcherType.class)
source
share