I have written a filter called RequestFilter (implements Filter interface) to get HTTP headers of each request. And I added this filter using the following code in Dropwizard run function.
environment.servlets().addFilter("RequestFilter", new RequestFilter());
doFilter doesn't get called on sending a request.
Any hints on why it is not working?
Resolved this issue by adding the following in dropwizard run function.
environment.servlets().addFilter("RequestFilter", new RequestFilter()).addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "<resource_path>/*");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With