struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben McCann <bmcc...@google.com>
Subject Re: getting the container (or Configuration/ConfigurationManager) in a non-container-instantiated object
Date Thu, 10 Feb 2011 19:20:39 GMT
If I'm understanding correctly, I had the same problem writing the Guice
plugin.  Our solution was probably a bit ugly, but it was the only way I
could find of making it work, so maybe it will help you:
http://code.google.com/p/google-guice/source/browse/trunk/extensions/struts2/src/com/google/inject/struts2/Struts2Factory.java


On Thu, Feb 10, 2011 at 11:02 AM, Wes Wannemacher <wesw@wantii.com> wrote:

> Because, I'm not in a request-processing thread...
>
> In this app, I have a ServletContextListener that launches threads for
> managing some housekeeping stuff (in this case, looking for specific
> xml files in jars). I need the configured packages (PackageConfigs)
> within one of these threads.
>
> I did try to get the Dispatcher instance, but it kept coming back
> null, which led me to dig a bit and then I realized that I am not in a
> request processing thread (neither is the ServletContextListener that
> launched the thread). I am going to try to poke around the
> ServletContext to see if I can get the container that way.
>
> -Wes
>
> On Thu, Feb 10, 2011 at 1:29 PM, Maurizio Cucchiara
> <maurizio.cucchiara@gmail.com> wrote:
> > Wes,
> > to be frankly I didn't get what you said.
> >
> > Dispatcher.getInstance().getContainer() should be yield a container
> > reference (among the other things it's the better way a know in order
> > to do that).
> >
> > What's the problem with the threadlocal stuff?
> >
> > On 10 February 2011 17:43, Wes Wannemacher <wesw@wantii.com> wrote:
> >> Guys,
> >>
> >> I am in a non-struts environment (spring class, loaded by a customer
> >> ServletContextListener), and I am trying to get my hands on the Struts
> >> 2 configuration. I first tried to do -
> >>
> >> Dispatcher.getInstance().getContainer()
> >>
> >> But, the dispatcher instance is a threadlocal. I don't really care
> >> about the dispatcher, I'd just like to get a ref to the container.
> >>
> >> Any ideas?
> >>
> >> -Wes
> >>
> >> --
> >> Wes Wannemacher
> >>
> >> Head Engineer, WanTii, Inc.
> >> Need Training? Struts, Spring, Maven, Tomcat...
> >> Ask me for a quote!
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: dev-help@struts.apache.org
> >>
> >>
> >
> >
> >
> > --
> > Maurizio Cucchiara
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> > For additional commands, e-mail: dev-help@struts.apache.org
> >
> >
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message