You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rui Tang <ta...@gmail.com> on 2010/08/28 18:07:05 UTC

How to Inject Servlet Context into My Services Using T5 IoC

Hi there,

I'm using T5 IoC independently.

I'm developing a web application and having a ServletContextListener to
handle the webapp startup event. In this event, I use IOCUtilities to build
a registry. And then all services are defined. But in some of the services,
I want to inject the servlet context into it in order to get some
configuration parameters, but I found that can't (maybe I'm wrong) in the
way of using module build methods or contribution methods. According to the
tapestry-spring module, I find a ModuleDef type seems help. I want to know
if this is the common way to do this? Or should I use some other ways. Some
simple examples would be very appreciated.

Thank you!

-- 
唐睿

Re: How to Inject Servlet Context into My Services Using T5 IoC

Posted by Rui Tang <ta...@gmail.com>.
No, I don't use TapestryFilter.

Maybe I should take a look at tapestry-core. Before, I just want to use T5
IoC as an IoC container in my application, but not the whole tapestry
project.

>From reading the TapestryFile's code, I got some ideas.

Thank you!

On Sun, Aug 29, 2010 at 4:05 PM, Igor Drobiazko <ig...@gmail.com>wrote:

> Do I understand you correctly? You are not using the TapestryFilter? If
> not,
> you should. This is the place where the registry is built and enriched with
> all the stuff from the servlet API.
>
> On Sat, Aug 28, 2010 at 6:07 PM, Rui Tang <ta...@gmail.com> wrote:
>
> > Hi there,
> >
> > I'm using T5 IoC independently.
> >
> > I'm developing a web application and having a ServletContextListener to
> > handle the webapp startup event. In this event, I use IOCUtilities to
> build
> > a registry. And then all services are defined. But in some of the
> services,
> > I want to inject the servlet context into it in order to get some
> > configuration parameters, but I found that can't (maybe I'm wrong) in the
> > way of using module build methods or contribution methods. According to
> the
> > tapestry-spring module, I find a ModuleDef type seems help. I want to
> know
> > if this is the common way to do this? Or should I use some other ways.
> Some
> > simple examples would be very appreciated.
> >
> > Thank you!
> >
> > --
> > 唐睿
> >
>
>
>
> --
> Best regards,
>
> Igor Drobiazko
> http://tapestry5.de
>



-- 
唐睿

Re: How to Inject Servlet Context into My Services Using T5 IoC

Posted by Igor Drobiazko <ig...@gmail.com>.
Do I understand you correctly? You are not using the TapestryFilter? If not,
you should. This is the place where the registry is built and enriched with
all the stuff from the servlet API.

On Sat, Aug 28, 2010 at 6:07 PM, Rui Tang <ta...@gmail.com> wrote:

> Hi there,
>
> I'm using T5 IoC independently.
>
> I'm developing a web application and having a ServletContextListener to
> handle the webapp startup event. In this event, I use IOCUtilities to build
> a registry. And then all services are defined. But in some of the services,
> I want to inject the servlet context into it in order to get some
> configuration parameters, but I found that can't (maybe I'm wrong) in the
> way of using module build methods or contribution methods. According to the
> tapestry-spring module, I find a ModuleDef type seems help. I want to know
> if this is the common way to do this? Or should I use some other ways. Some
> simple examples would be very appreciated.
>
> Thank you!
>
> --
> 唐睿
>



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de