ServletRequest
ServletResponse
FilterChain
跳转到拦截的路径:chain.doFilter(request, response)
以访问的jsp为:http://localhost:8080/dmsd-itoo-exam-log-web/course/index.jsp,工程名为/dmsd-itoo-exam-log-web为例:HttpServletRequest
request.getContextPath(),得到工程名:/dmsd-itoo-exam-log-web;
request.getServletPath(),返回当前页面所在目录下全名称:/course/index.jsp;
request.getRequestURL(),返回IE地址栏地址:http://localhost:8080/dmsd-itoo-exam-log-web/course/index.jsp;
request.getRequestURI() ,返回包含工程名的当前页面全路径:/dmsd-itoo-exam-log-web/course/index.jsp。
HttpServletResponse
重定向跳转controller相同的请求中:response.sendRedirect("路径")
HttpSession
session.setAttribute("键","值")