Can't you do it in a filter? - 

public void doFilter(ServletRequest request, ServletResponse response,
                        FilterChain chain) throws IOException,
ServletException {
        HttpServletRequest req = (HttpServletRequest) request;
        ServletContext context = session.getServletContext(); 
        Registry registry = (Registry)
context.getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);
        MyServiceInterface myInjectedServiceInstance =
registry.getService(YourServiceInterface.class)

Regards,
Jim.

-----Original Message-----
From: Jimmy.Lew [mailto:jae...@aol.com] 
Sent: 29 June 2010 13:58
To: users@tapestry.apache.org
Subject: Re: Is there anyway to access injected service instance out of box?


You mean like this:

......
Registry reg=servletContext.getAttribute(REGISTRY_CONTEXT_NAME);
MyserviceInterface
myInjectedServiceInstance=reg.getService("MyserviceID",MyserviceInterface.cl
ass);
......

but how could i get the singleton ServletContext object outside tapestry, i
couldn't find any static method to reach this?



Christophe Cordenier wrote:
> 
> Hi
> 
> Tapestry Registry allows you to access all the services your have
> declared,
> it is available in the servlet context under this name :
> 
>     public static final String REGISTRY_CONTEXT_NAME =
> "org.apache.tapestry5.application-registry";
> 
> 2010/6/29 Jimmy.Lew <jae...@aol.com>
> 
>>
>> Does Tapestry IOC module  provide API to allow other frameworks to access
>> injected service instance? e.g., i want to use DWR to check a injected
>> session manager service in a tapestry page. Appreciate somebody could
>> give
>> a
>> hint.
>> --
>> View this message in context:
>>
http://old.nabble.com/Is-there-anyway-to-access-injected-service-instance-ou
t-of-box--tp29020920p29020920.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
> 
> 
> -- 
> Regards,
> Christophe Cordenier.
> 
> Committer on Apache Tapestry 5
> Co-Creator of wooki @wookicentral.com
> 
> 

-- 
View this message in context:
http://old.nabble.com/Is-there-anyway-to-access-injected-service-instance-ou
t-of-box--tp29020920p29023334.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to