- <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;