首页>代码>基于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;
    }

}
最近下载更多
陈小灏  LV18 2月21日
蓝羊羊  LV20 2月15日
lxllxllxlLXL  LV1 2024年12月26日
微信网友_7289626841501696  LV3 2024年12月24日
1121173448  LV2 2024年12月18日
yiyuyixia  LV3 2024年12月17日
短巷拥猫  LV12 2024年12月14日
userSu  LV1 2024年11月29日
zolscy  LV24 2024年11月24日
最近浏览更多
小月月呀  LV19 3月29日
孤独求败1 3月25日
暂无贡献等级
W670597  LV2 3月25日
没有啊很开心啊  LV4 3月7日
PLVAE_514  LV2 3月7日
docnnxxy688 3月1日
暂无贡献等级
哥斯拉b 2月28日
暂无贡献等级
stonemachen  LV3 2月27日
哪里的完整版  LV8 2月26日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友