赞
踩
站在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是我自己注的,源码为
- package org.business.user.config;
-
- import java.io.IOException;
-
- import javax.servlet.FilterChain;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
-
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.stereotype.Component;
- import org.springframework.web.filter.OncePerRequestFilter;
-
- @Component
- public class MyFilter extends OncePerRequestFilter{
-
- private Logger logger = LoggerFactory.getLogger(MyFilter.class);
-
-
- public MyFilter() {
- super();
- logger.info("start");
- }
-
-
- @Override
- protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
- throws ServletException, IOException {
- logger.info("begin");
- filterChain.doFilter(request, response);
- logger.info("end");
- }
-
- }
文章的重点:这是一个spring security环境,UsernamePasswordAuthenticationFilter 这个却没有出现在上面。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。