I have a bean which provides easy access on the web server side to the HttpServletResponse and HttpServletRequest objects of the current request.
To get the HttpServletRequest I simply added this to web.xml:
Then referred to the object in the bean by:Code:<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener>
I am having trouble locating an easily efficient way to access the HttpServletResponse. Can anyone help?Code:public HttpServletRequest getRequest() { ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); return attr.getRequest(); }
Thanks
Gene


Reply With Quote
