首页>代码>基于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; } }
最近浏览更多
是数据库 LV3
昨天
微信网友_6927932988952576 LV12
昨天
yimaoermao LV1
昨天
xiaozhi丶 LV15
昨天
罗清晨 LV13
前天
最代码官方 LV168
11月2日