//package com.iailab.module.data.framework.filter;
|
//
|
//import org.apache.logging.log4j.LogManager;
|
//import org.apache.logging.log4j.Logger;
|
//import org.springframework.stereotype.Component;
|
//
|
//import javax.servlet.*;
|
//import javax.servlet.http.HttpServletRequest;
|
//import java.io.IOException;
|
//
|
//public class MyFilter implements Filter {
|
//
|
// private static final Logger LOGGER = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);
|
//
|
// @Override
|
// public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
// LOGGER.info("过滤器filter3开始 doFilter");
|
// ServletRequest requestWrapper = null;
|
// if(request instanceof HttpServletRequest) {
|
// requestWrapper = new MyHttpServletRequestWrapper((HttpServletRequest) request);
|
// }
|
// //获取请求中的流如何,将取出来的字符串,再次转换成流,然后把它放入到新request对象中。
|
// // 在chain.doFiler方法中传递新的request对象
|
// if(requestWrapper == null) {
|
//
|
// chain.doFilter(request, response);
|
// } else {
|
// chain.doFilter(requestWrapper, response);
|
// }
|
// }
|
//}
|