- <listener>
- <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
- </listener>
- public static HttpServletRequest getRequest(){
- HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
- return req;
- }
- public static HttpServletResponse getResponse(){
- HttpServletResponse resp = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse();
- return resp;
- }
- @Autowired
- private HttpSession session;
- @Autowired
- private HttpServletRequest request;
posted on 2018-04-19 19:19 阅读( ...) 评论( ...)