In the init() method you can get a reference to the ServletContext from the 
FilterConfig object... then you can either use it then or store it in an instance 
variable of the filter. If you filter is acting across more than one context this is 
not a good idea; howerver, I don't think they can... am I wrong?

The filter has always seemed a bit lacking to me.

Hope this helps.

Chris
[EMAIL PROTECTED]
 

-----Original Message-----
From: Tim Colson <[EMAIL PROTECTED]>
Sent: Sep 23, 2004 2:14 PM
To: [EMAIL PROTECTED]
Subject: RE: [jug-discussion] How to grab a Spring configured bean?

So I've found some info on getting the Spring Context inside a generic
servlet.

ServletContext servletContext =
  this.getServletContext();
WebApplicationContext wac =
WebApplicationContextUtils.getWebApplicationContext(servletContext);

But where I need to get the context is inside a class that is a Servlet
Filter... which does not have access to a servlet context (presumably
because filters can act cross contexts?)

So I'm still stuck. :-(

Timo

> -----Original Message-----
> From: Tim Colson [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 23, 2004 1:32 PM
> To: [EMAIL PROTECTED]
> Subject: [jug-discussion] How to grab a Spring configured bean?
> 
> Hey folks -
>   I'm trying to understand and use Spring, falling down a bit. 
> 
> I have a "ds" bean in Spring config (DataSource), and a 
> Struts action which
> extends DispatchActionSupport. It is easy to grab the bean using:
> getWebApplicationContext().getBean("ds");
> 
> Cool.... but now I am in another class which is not an action 
> -- and I'm at
> a loss how to grab the "ds" bean. :-(
> 
> I'm reading the 200 pages of docs ...but if anybody could 
> point me to the
> relevant bit to jump-start me, that'd be great!
> 
> Timo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Christopher J. Stehno
[EMAIL PROTECTED]
www.stehno.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to