In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
A very simple login permission interceptor
Question 1: login page submission request must be filtered out, currently configured in xml to filter, can you configure not to intercept certain requests. If you need to intercept requests in this configuration, it's too much trouble when there are too many requests.
Question 2: I simply determine whether the session has a value in the interceptor, if there is a login, if not jump to the login page. The way I do it is not good. Is there a correct and effective method?
Question 3: If you can give a solution to jump pages in the interceptor, my login.jsp is placed under WEB-INF. When jumping through ModelAndView, the view parser will jump to/WEB-INF/login.jsp, which is definitely not the page. But if I put it in this folder, the browser won't be able to access the login.jsp page.
public class UserInterceptor implements HandlerInterceptor{ @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object obj, Exception err) throws Exception { } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object obj, ModelAndView mav) throws Exception { response.sendRedirect("/login.jsp"); } @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception { String str = (String) request.getSession().getAttribute("isLogin"); System.out.println("str=========>"+str); if(str!= null){ return true; } return false; } }
Get [Download address]
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.