package com.bybo.aca.web.interceptor;

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

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

public class Login implements HandlerInterceptor {

    @Override
    public void afterCompletion(HttpServletRequest httpRequest,
            HttpServletResponse httpResponse, Object arg2, Exception arg3)
            throws Exception {
         
    }

    @Override
    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1,
            Object arg2, ModelAndView arg3) throws Exception {
        

    }

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
            Object object) throws Exception {
        /*HttpServletRequest httpRequest = (HttpServletRequest) request;  
         HttpServletResponse httpResponse = (HttpServletResponse) response;*/
        String urlString = request.getRequestURI();
            
        ///olForum/forumList.html模拟登录页
     //这个地方要做判断不然会无限循环重定向,即执行过滤器、拦截器很多遍 if(urlString.endsWith("forumList.html")){ return true; } //请求的路径 String contextPath=request.getContextPath(); /*httpRequest.getRequestDispatcher("/olForum/forumList").forward(httpRequest, httpResponse);*/ /*response.sendRedirect(contextPath+"/olForum/forumList.html");*/ response.sendRedirect(contextPath + "/olForum/forumList.html?login=aaa"); return false; /*httpResponse.sendRedirect(httpRequest.getContextPath()+"/olForum/forumList.html"); return;*/ } }

 

相关文章:

  • 2022-12-23
  • 2021-06-19
  • 2021-08-16
  • 2021-10-02
  • 2021-10-17
  • 2021-04-26
猜你喜欢
  • 2022-12-23
  • 2021-04-10
  • 2021-11-30
  • 2021-12-26
  • 2021-07-11
  • 2022-02-15
  • 2021-03-31
相关资源
相似解决方案