See related: Accessing HttpServletRequest object in a normal Java class from Spring
Note, this one is about RESPONSE...
"I have a normal Java class in a Spring MVC 3.06 web application.
In this class I would like to inject or get hold of the HttpServletResponse object in a method.
I know I can pass this around, but I was wondering how can I get hold of the response without passing it in to the method. Perhaps using annotations or similar?
Also, what are the "real" concerns with getting hold of the response this way, except some peoples opinions of it being ugly coding. I mean, is it unstable to access it this way? Costly performance wise?
Preferably non application server dependent way. have a normal Java class in a Spring MVC 3.06 web application.
Thanks! "