The thing is, you can inject the Request object itself.  The proxy
encapsulates the service scope ... so any thread can invoke methods on
the proxy, but will end up accessing the per-thread Request
implementation.  Actually, no different than injecting RequestGlobals,
the proxy handles delegation to the request property of
RequestGlobals.

On Nov 28, 2007 9:28 AM, jeffrey ai <[EMAIL PROTECTED]> wrote:
>
> That solves the problem, thanks, folks.
> I put my contribute code in AppModule here for later reference.
> ===
>         public static void contributeBindingSource( 
> MappedConfiguration<String,
> BindingFactory> configuration,
>                         @InjectService("RequestGlobals")
>                         RequestGlobals requestGlobals )
>         {
>                 configuration.add( "pmsg", new
> PersonalizedMessageBindingFactory(requestGlobals) );
>         }
> ===
>
> Cheers,
> Jeffrey Ai
>
>
>
> Howard Lewis Ship wrote:
> >
> > Remember that service injection is ONLY through the constructor,
> > whereas component injection is ONLY through private instance
> > variables.
> >
> > On Nov 27, 2007 2:57 PM, Filip S. Adamsen <[EMAIL PROTECTED]> wrote:
> >> Hi Jeffrey,
> >>
> >> Try injecting org.apache.tapestry.service.Request:
> >> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/Request.html
> >>
> >> That should do the trick.
> >>
> >> -Filip
> >>
> >> jeffrey ai skrev:
> >>
> >> > Thanks, Filip.
> >> > I tried to inject RequestGlobals, like I did for normal component, but
> >> that
> >> > doesn't work.
> >> > It's not correctly injected.
> >> >
> >> >
> >> > Filip S. Adamsen-2 wrote:
> >> >> Have you tried injecting the request directly into your
> >> BindingFactory?
> >> >>
> >> >> -Filip
> >> >>
> >> >> jeffrey ai skrev:
> >> >>> Hi Folks,
> >> >>>
> >> >>> I think I'm missing something here, but would appreciate a shove in
> >> the
> >> >>> right direction.
> >> >>> I created a new BindingFactory, introduced a new prefix, and
> >> successfully
> >> >>> contributed it to BindingSource.
> >> >>> I am trying to do the following things in my new BindingFactory,
> >> >>> =====
> >> >>>     public Binding newBinding( String description, ComponentResources
> >> >>> container, ComponentResources component,
> >> >>>                     String expression, Location location )
> >> >>>     {
> >> >>>             final HttpServletRequest request =
> >> getRequestFromComponent(component);
> >> >>>
> >> >>>             final String personalizedMessage =
> >> >>> getPersonalizedMessage(request.getParameter("personID"), expression);
> >> >>>
> >> >>>             return new LiteralBinding( description,
> >> personalizedMessage, location
> >> >>> );
> >> >>>     }
> >> >>> =====
> >> >>>
> >> >>> I couldn't find a way to dig the Http request out from the component
> >> at
> >> >>> this
> >> >>> point -- page expansion phase.
> >> >>>
> >> >>> Thanks for any advice,
> >> >>> Jeffrey Ai
> >> >> ---------------------------------------------------------------------
> >> >> 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]
> >>
> >>
> >
> >
> >
> > --
> > Howard M. Lewis Ship
> > Partner and Senior Architect at Feature50
> >
> > Creator Apache Tapestry and Apache HiveMind
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/T5%3A-Is-there-a-way-to-make-a-BindingFactory-request-aware-tf4884618.html#a13996037
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

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

Reply via email to