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?
通过在dropwizard运行函数中添加以下内容解决了此问题。
environment.servlets().addFilter("RequestFilter", new RequestFilter()).addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "<resource_path>/*");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.