首页>代码>基于SpringBoot实现的学生就业管理系统>/源代码/employment/src/main/java/com/project/config/AdminInterceptor.java
package com.project.config; import com.project.entity.User; import com.project.uitls.Constant; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * @author: liangrenren * @date: 2021-03-04 11:30 **/ @Component public class AdminInterceptor implements HandlerInterceptor { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { try { User user = (User) request.getSession().getAttribute(Constant.CURRENT_USER); if(user != null){ return true; } response.setHeader("REDIRECT","REDIRECT"); response.setHeader("PATH","/index.html"); } catch (Exception e) { e.printStackTrace(); } return false; } }
最近下载更多
15953970869 LV6
11月10日
最代码官方 LV168
11月2日