Ok, let me summarize how I understood the IOC documentation:

1. Inside AppModule, every public method that exists is called when the 
webapplication is loaded for the first time.

2. every method that starts with build..... will generate an IOC service with 
the name followed by the keyword "build."

Example:

 "public buildMyService ()" will lead to a new IOC service called MyService.


3. if such a method contains variables, services with the variables' names are 
searched inside the IOC registry...and are automatically injected into the 
service. The @Inject is not necessary sometimes (if it is a "shadow service").

Example 1:

public buildMyService (final Logger log) // injects the IOC Service with the 
name "Logged" automatically which is a shadow service, otherwise it would be:

public buildMyService (@InjectService final Logger log)

Example 2:

public buildMyService (final Logger log, final RequestGlobals requestGlobals)

would inject the shadow service RequestGlobals.

Example 3:

public buildMyService (final Logger log, final RequestGlobals requestGlobals, 
@InjectService ThreadLocale threadLocale)

would inject the shadow service RequestGlobals and the normal IOC service 
threadLocale 

Is this how it works?

Thanks!

Toby

-------- Original-Nachricht --------
> Datum: Fri, 21 Nov 2008 08:51:52 -0800
> Von: "Howard Lewis Ship" <[EMAIL PROTECTED]>
> An: "Tapestry users" <users@tapestry.apache.org>
> Betreff: Re: @InjectService("RequestGlobals")

> Do you see what your doing for the Logger?  Do the same thing.
> 
> On Fri, Nov 21, 2008 at 5:57 AM,  <[EMAIL PROTECTED]> wrote:
> > How do you inject RequestGlobals inside of AppModule ?
> >
> > I have tried:
> >
> >  public RequestFilter buildTimingFilter(final Logger log)
> >    {
> >        return new RequestFilter()
> >        {
> >
> >
> >            public boolean service(Request request, Response response,
> >                        RequestHandler handler)
> >                    throws IOException
> >            {
> >
> >
> >                @InjectService("RequestGlobals") RequestGlobals
> requestGlobals;
> > // disallowed for this location
> >
> >
> > Inside of:
> >
> >  public boolean service(Request request, Response response,
> >                        @InjectService("RequestGlobals") RequestGlobals
> requestGlobals,
> >                        RequestHandler handler)
> >                    throws IOException
> >
> > it does not work because the service method needs to have 2 parameters
> only.....
> >
> >
> > Inside of here:
> >
> >  public RequestFilter buildTimingFilter(final Logger log)
> >    {
> >        return new RequestFilter()
> >        {
> >
> >                @InjectService("RequestGlobals") RequestGlobals
> requestGlobals,
> >
> > it is also disallowed.
> >
> >
> > The same here:
> >
> >  public RequestFilter buildTimingFilter(final Logger log)
> >    {
> >
> >        @InjectService("RequestGlobals") RequestGlobals requestGlobals,
> >
> >
> > or here:
> >
> >
> >        @InjectService("RequestGlobals") RequestGlobals requestGlobals,
> >
> >    public RequestFilter buildTimingFilter(final Logger log)
> >    {
> >
> >
> > I can not find any other places to put this @InjectService annotation.
> >
> > Any help is appreciated....
> >
> > Thanks!
> >
> > Toby
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to