当前位置:   article > 正文

springboot中的filter_org.springframework.web.server.webfilter

org.springframework.web.server.webfilter

站在tomcat容器的角度来看,容器上注册了上面几个filter。

1、 ApplicationFilterConfig[name=characterEncodingFilter, filterClass=org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter]
2、ApplicationFilterConfig[name=formContentFilter, filterClass=org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]
3、ApplicationFilterConfig[name=requestContextFilter, filterClass=org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter]
4、ApplicationFilterConfig[name=springSecurityFilterChain, filterClass=org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean$1]
5、ApplicationFilterConfig[name=myFilter, filterClass=org.business.user.config.MyFilter]
6、ApplicationFilterConfig[name=Tomcat WebSocket (JSR356) Filter, filterClass=org.apache.tomcat.websocket.server.WsFilter]

这里的MyFilter是我自己注的,源码为

  1. package org.business.user.config;
  2. import java.io.IOException;
  3. import javax.servlet.FilterChain;
  4. import javax.servlet.ServletException;
  5. import javax.servlet.http.HttpServletRequest;
  6. import javax.servlet.http.HttpServletResponse;
  7. import org.slf4j.Logger;
  8. import org.slf4j.LoggerFactory;
  9. import org.springframework.stereotype.Component;
  10. import org.springframework.web.filter.OncePerRequestFilter;
  11. @Component
  12. public class MyFilter extends OncePerRequestFilter{
  13. private Logger logger = LoggerFactory.getLogger(MyFilter.class);
  14. public MyFilter() {
  15. super();
  16. logger.info("start");
  17. }
  18. @Override
  19. protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
  20. throws ServletException, IOException {
  21. logger.info("begin");
  22. filterChain.doFilter(request, response);
  23. logger.info("end");
  24. }
  25. }

文章的重点:这是一个spring security环境,UsernamePasswordAuthenticationFilter 这个却没有出现在上面。 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/576283
推荐阅读
相关标签
  

闽ICP备14008679号