当前位置:   article > 正文

filter实现登录验证,并实现页面跳转到登录前浏览的页面(同步异步皆可)_gateway的filter跳转登录页面

gateway的filter跳转登录页面

框架使用SSH

1、首先写好filter,如下

  1. package com.alpha.web.filter;
  2. import java.io.IOException;
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. import javax.servlet.Filter;
  6. import javax.servlet.FilterChain;
  7. import javax.servlet.FilterConfig;
  8. import javax.servlet.ServletException;
  9. import javax.servlet.ServletRequest;
  10. import javax.servlet.ServletResponse;
  11. import javax.servlet.http.HttpServletRequest;
  12. import javax.servlet.http.HttpServletResponse;
  13. import javax.servlet.http.HttpSession;
  14. public class CheckLoginFilter implements Filter {
  15. private String redirectURL = "";
  16. private List<String> notCheckURLList = null;
  17. @Override
  18. public void destroy() {
  19. this.notCheckURLList.clear();
  20. }
  21. @Override
  22. public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
  23. FilterChain filterChain) throws IOException, ServletException {
  24. HttpServletRequest request = (Htt
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/算法创新者/article/detail/61353
推荐阅读
相关标签
  

闽ICP备14008679号