Re: [jug-discussion] grab a Spring configured bean - part Deux

2004-09-23 Thread Nicholas Lesiecki
a "ds" bean... can Spring just do MyServletFilter.setDataSource(myDataSourceBean) at startup? Unless Spring instantiates the bean, the answer is "no." You can ask spring to configure a bean programmatically: http://opensource.atlassian.com/projects/spring/browse/SPR-266 relevant bit: <<< I've ju

Re: [jug-discussion] Java "core" files?

2004-09-23 Thread Andrew Huntwork
linux has "misc-binary" support. i haven't played with it in years, but i think there's some proc-fs interface for specifying a handler executable to miscellaneous executables by extension or something. basically, you tell the kernel that /usr/bin/java handles files with extension .jar, chmod

Re: [jug-discussion] Java "core" files?

2004-09-23 Thread William H. Mitchell
At 06:29 AM 9/20/2004 -0700, Drew Davidson wrote: > >I think about the closest you are going to get on a Java VM is the old >ctrl-break trick (on Windows) to generate a thread dump. Not exactly a >core file, but then again what could you do with a Java core file >anyway? There aren't any debug

RE: [jug-discussion] grab a Spring configured bean - part Deux

2004-09-23 Thread Tim Colson
Hey gang - I managed to hack the Filter to get a ServletContext and then the Spring WebApplicationContext. Thanks to all for the many helpful replies. Nick wrote: > Cast the request to an http servlet request. That should have > access to the session, which has access to the context.(I think).

Re: [jug-discussion] How to grab a Spring configured bean?

2004-09-23 Thread Drew Davidson
Andrew Barton wrote: We had the same problem. I have come up with a solution, but it may be a bit of a hack. If anyone else has a better solution, I would love to hear it. My solution involves the use of a singleton, initialized by a servlet that loads at application start up. I then use a utility

Re: [jug-discussion] How to grab a Spring configured bean?

2004-09-23 Thread Andrew Barton
Hi Tim, We had the same problem. I have come up with a solution, but it may be a bit of a hack. If anyone else has a better solution, I would love to hear it. My solution involves the use of a singleton, initialized by a servlet that loads at application start up. I then use a utility to simplify

Re: [jug-discussion] How to grab a Spring configured bean?

2004-09-23 Thread Robert Zeigler
Timo, I'm not a spring expert, so I set out to the trusty google... following article looked fairly promising... http://www.devx.com/Java/Article/21665 Had some examples of using XmlBeanFactory to get at the info (apparently not really recommended, though), discussion of setter/constructor depen

Re: [jug-discussion] How to grab a Spring configured bean?

2004-09-23 Thread Nicholas Lesiecki
Cast the request to an http servlet request. That should have access to the session, which has access to the context.(I think). Good luck. --nick On Sep 23, 2004, at 2:14 PM, Tim Colson wrote: So I've found some info on getting the Spring Context inside a generic servlet. ServletContext servletCo

RE: [jug-discussion] How to grab a Spring configured bean?

2004-09-23 Thread Christopher J. Stehno
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...

RE: [jug-discussion] How to grab a Spring configured bean?

2004-09-23 Thread Tim Colson
Rambling away...slowing getting closer... > 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?) Wrong. In the Filter Init, there is a FilterConfig object which

RE: [jug-discussion] How to grab a Spring configured bean?

2004-09-23 Thread Tim Colson
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 i

[jug-discussion] How to grab a Spring configured bean?

2004-09-23 Thread Tim Colson
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 clas