Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Miguel
On Fri, 2011-05-27 at 09:00 -0400, Dave Newton wrote: > On Friday, May 27, 2011, Miguel wrote: > > Following my previous email and agreeing with you on this, I might, of > > course, get off the request hook by changing the request injection with > > injecting, for example, those two properties (u

Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Dave Newton
On Friday, May 27, 2011, Miguel wrote: > Following my previous email and agreeing with you on this,  I might, of > course, get off the request hook by changing the request injection with > injecting, for example, those two properties (username and ipaddress) to > this class, but the underlying prob

Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Miguel
On Fri, 2011-05-27 at 13:24 +0100, Miguel wrote: > Hi Dave, > > On Fri, 2011-05-27 at 08:10 -0400, Dave Newton wrote: > > > What specifically do you need an actual request for? This strikes me > > as coupling your design to the servlet spec, and there's rarely a > > strong reason to do that past

Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Andrew Lee
Dave is right that it suggests its bad design but if you really need it you can get your action to implement servletrequestaware: http://struts.apache.org/2.0.11/struts2-core/apidocs/org/apache/struts2/interceptor/package-summary.html Might be better to create a threadlocal in an interceptor to s

Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Miguel
Hi Dave, On Fri, 2011-05-27 at 08:10 -0400, Dave Newton wrote: > What specifically do you need an actual request for? This strikes me > as coupling your design to the servlet spec, and there's rarely a > strong reason to do that past the web layer itself. The idea on > injecting a request just se

Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Dave Newton
What specifically do you need an actual request for? This strikes me as coupling your design to the servlet spec, and there's rarely a strong reason to do that past the web layer itself. The idea on injecting a request just seems wrong. Is that a Struts 2 interceptor you're trying to inject it in

Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Miguel
Hi, I'm using spring to inject dependencies in my application. I added a module I had previously developed that had the code in some class (request is a HttpServletRequest): private String getIpAddress() { request = ServletActionContext.getRequest();