<commit_before>package com.tlh.sys.interceptor;

import org.apache.shiro.SecurityUtils;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by hup on 2017/1/8.
 */
public class RightFilterInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
        String uri = httpServletRequest.getRequestURI();
        uri=uri.substring(uri.lastIndexOf("/"));
        //如果是首页或登录请求
        if(uri.equals("/")||uri.equals("/login")){
            return true;
        }
        Object principal = SecurityUtils.getSubject().getPrincipal();
        if(principal==null){
            httpServletRequest.setAttribute("msg","请重新登陆");
            httpServletRequest.getRequestDispatcher("login").forward(httpServletRequest,httpServletResponse);
            return false;
        }
        return true;
    }
<commit_msg>1.处理用户过滤的bug<commit_after>package com.tlh.sys.interceptor;

import org.apache.shiro.SecurityUtils;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by hup on 2017/1/8.
 */
public class RightFilterInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
        String uri = httpServletRequest.getRequestURI();
        uri=uri.substring(uri.lastIndexOf("/"));
        //如果是首页或登录请求
        if(uri.equals("/")||uri.equals("/login")){
            return true;
        }
        Object principal = SecurityUtils.getSubject().getPrincipal();
        if(principal==null){
            httpServletRequest.setAttribute("msg","请重新登陆");
            httpServletRequest.getRequestDispatcher("/login").forward(httpServletRequest,httpServletResponse);
            return false;
        }
        return true;
    }

{'fraction_non_alphanumeric': 0.10701438848920863, 'fraction_numerical': 0.005845323741007194, 'mean_word_length': 3.625779625779626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6078995', 'n_tokens_mistral': 600, 'n_tokens_neox': 604, 'n_words': 102}