由struts2原理图可知道,interceptor发生在action调用之前,拦截器的参数就是ActionInvocation(action实例),ActionInvocation里封装了HttpServletRequest,
HttpServletRequest request = (HttpServletRequest)ai.getInvocationContext().get(ServletActionContext.HTTP_REQUEST);即可得到request,当然,也可以得到Cookie[]cookies = request.getCookies();
HttpServletRequest request = (HttpServletRequest)ai.getInvocationContext().get(ServletActionContext.HTTP_REQUEST);即可得到request,当然,也可以得到Cookie[]cookies = request.getCookies();