You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Jimmy.Lew" <ja...@aol.com> on 2010/06/29 09:29:59 UTC

Is there anyway to access injected service instance out of box?

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-out-of-box--tp29020920p29020920.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Is there anyway to access injected service instance out of box?

Posted by Christophe Cordenier <ch...@gmail.com>.
Also

Just an add, if you use spring, you can implement the ServletContextAware
interface to extract the Tapestry Registry.

2010/6/29 Thiago H. de Paula Figueiredo <th...@gmail.com>

> I think the best approach would be to define this code that needs the
> Registry as Tapestry-IoC services, so service injection would be automatic.
> Don't forget that Tapestry-IoC is completely independent from
> Tapestry-the-web-framework (tapestry-core). This would work for web or
> non-web projects. In completely non-web projects, you would need to create
> the Registry yourself:
> http://tapestry.apache.org/tapestry5.1/tapestry-ioc/run.html. If you
> really need to get services in runtime, inject the ObjectLocator service.
>
> Taking a look at the TapestryFilter source, a desperate solution is to
> subclass it. In this subclass, you would have a static field pointing to the
> Registry instance. I would override the TapestryFilter.init(Registry
> registry) so it would set the static field.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-creator of wooki @wookicentral.com

Re: Is there anyway to access injected service instance out of box?

Posted by "Jimmy.Lew" <ja...@aol.com>.
srry, the tapestry-ioc framework, copy error, -:)



Thiago H. de Paula Figueiredo wrote:
> 
> On Tue, 29 Jun 2010 16:12:07 -0300, Jimmy.Lew <ja...@aol.com> wrote:
> 
>> It would be nice, if the tapestry framework can provide a bridge module  
>> between tapestry-core and tapestry-ioc,  e.g, separate the  
>> registryinitialization coding from the TapestryFilter. why not building  
>> a ioc
>> registration management sub-module that is able to generate and maintain  
>> IOC Registry from different ioc frameworks, since the Registry is vital
>> important.
> 
> Different IoC frameworks? I'm not following you.
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


Re: Is there anyway to access injected service instance out of box?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 29 Jun 2010 16:12:07 -0300, Jimmy.Lew <ja...@aol.com> wrote:

> It would be nice, if the tapestry framework can provide a bridge module  
> between tapestry-core and tapestry-ioc,  e.g, separate the  
> registryinitialization coding from the TapestryFilter. why not building  
> a ioc
> registration management sub-module that is able to generate and maintain  
> IOC Registry from different ioc frameworks, since the Registry is vital
> important.

Different IoC frameworks? I'm not following you.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: Is there anyway to access injected service instance out of box?

Posted by "Jimmy.Lew" <ja...@aol.com>.

Thiago H. de Paula Figueiredo wrote:
> 
> I think the best approach would be to define this code that needs the  
> Registry as Tapestry-IoC services, so service injection would be  
> automatic. Don't forget that Tapestry-IoC is completely independent from  
> Tapestry-the-web-framework (tapestry-core). This would work for web or  
> non-web projects. In completely non-web projects, you would need to create  
> the Registry yourself:  
> http://tapestry.apache.org/tapestry5.1/tapestry-ioc/run.html. If you  
> really need to get services in runtime, inject the ObjectLocator service.
> 
During the javadoc reading, i found that IOC test case implementation has
used the customized registry building way as you mentioned, that's pretty
convenient for tapestry testing.  



> Taking a look at the TapestryFilter source, a desperate solution is to  
> subclass it. In this subclass, you would have a static field pointing to  
> the Registry instance. I would override the TapestryFilter.init(Registry  
> registry) so it would set the static field.
> 

Actually, that is my last approach, i already did, i modified the
TapestryFilter init() method a bit to get the Registry object, looks really
invasive. It would be nice, if the tapestry framework can provide a bridge
module between tapestry-core and tapestry-ioc,  e.g, separate the registry
initialization coding from the TapestryFilter. why not building a ioc
registration management sub-module that is able to generate and maintain IOC
Registry from different ioc frameworks, since the Registry is vital
important.

Anyway, this is the best solution so far. Thanks for the suggested
solutions.
-- 
View this message in context: http://old.nabble.com/Is-there-anyway-to-access-injected-service-instance-out-of-box--tp29020920p29027266.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Is there anyway to access injected service instance out of box?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
I think the best approach would be to define this code that needs the  
Registry as Tapestry-IoC services, so service injection would be  
automatic. Don't forget that Tapestry-IoC is completely independent from  
Tapestry-the-web-framework (tapestry-core). This would work for web or  
non-web projects. In completely non-web projects, you would need to create  
the Registry yourself:  
http://tapestry.apache.org/tapestry5.1/tapestry-ioc/run.html. If you  
really need to get services in runtime, inject the ObjectLocator service.

Taking a look at the TapestryFilter source, a desperate solution is to  
subclass it. In this subclass, you would have a static field pointing to  
the Registry instance. I would override the TapestryFilter.init(Registry  
registry) so it would set the static field.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


RE: Is there anyway to access injected service instance out of box?

Posted by Jim O'Callaghan <jc...@yahoo.co.uk>.
Just to clarify Jimmy, you don't need to implement your own servlet filter -
that is just an example of some of my code getting a service from the ioc
registry - anywhere you can access the servlet context you should be able to
retrieve the service you want.  I'm a bit of a newbie myself with Tapestry,
but I'm not sure what benefit the access you are looking for would give - it
looks to me like the differences you are talking about are just semantics -
the servlet context is available through the web app - the registry is
available from the servlet context - the service you want is retrievable
from the ioc registry keyed on its interface name.  Perhaps what you are
looking for is access to the ioc registry from a non web app perspective?
I'm sure some of the more experienced Tapestry people on the list can point
you in the right direction if that is the case.

Regards,
Jim.

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


first of all, thanks million for the responses. If i didn't misunderstand ,
i
have to implement a customized filter under tapestry project.  My target is
to be able to get my injected service from the Registry object out of
tapestry module at run-time, the injected service is global singleton and it
is managed by Tapestry IOC module.

At run-time, the Registry object is initialized by "public final void
init(FilterConfig filterConfig)" method and is saved as an attribute object
of ServletContext. I'm just trying to get the Registry object out of
Tapestry module with noninvasive way, it seems that in the javadoc of
Tapestry, there's no such API that enables user to access injected service
through Registry object like: 

public static Registry RegistryFactory.getRegistry(String moduleName){...};

I think IOC module could use a Map like structure to manage the unique
Registry of every TapestryModule, like <ModuleName,Registry> and provide an
uniform Interface for other framework to access.





jc1001 wrote:
> 
> I forgot to put:
> 
> HttpSession session = req.getSession(false); 
> 
> ... in the code below.  Anyhoo just saw "static" in your original query -
> not sure if this is what you require.
> 
> Regards,
> Jim.
> 
> -----Original Message-----
> From: Jim O'Callaghan [mailto:jc1000001@yahoo.co.uk] 
> Sent: 29 June 2010 15:17
> To: 'Tapestry users'
> Subject: RE: Is there anyway to access injected service instance out of
> box?
> 
> 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:jaeluh@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 <ja...@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-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


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


RE: Is there anyway to access injected service instance out of box?

Posted by "Jimmy.Lew" <ja...@aol.com>.
first of all, thanks million for the responses. If i didn't misunderstand , i
have to implement a customized filter under tapestry project.  My target is
to be able to get my injected service from the Registry object out of
tapestry module at run-time, the injected service is global singleton and it
is managed by Tapestry IOC module.

At run-time, the Registry object is initialized by "public final void
init(FilterConfig filterConfig)" method and is saved as an attribute object
of ServletContext. I'm just trying to get the Registry object out of
Tapestry module with noninvasive way, it seems that in the javadoc of
Tapestry, there's no such API that enables user to access injected service
through Registry object like: 

public static Registry RegistryFactory.getRegistry(String moduleName){...};

I think IOC module could use a Map like structure to manage the unique
Registry of every TapestryModule, like <ModuleName,Registry> and provide an
uniform Interface for other framework to access.





jc1001 wrote:
> 
> I forgot to put:
> 
> HttpSession session = req.getSession(false); 
> 
> ... in the code below.  Anyhoo just saw "static" in your original query -
> not sure if this is what you require.
> 
> Regards,
> Jim.
> 
> -----Original Message-----
> From: Jim O'Callaghan [mailto:jc1000001@yahoo.co.uk] 
> Sent: 29 June 2010 15:17
> To: 'Tapestry users'
> Subject: RE: Is there anyway to access injected service instance out of
> box?
> 
> 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:jaeluh@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 <ja...@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-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


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


RE: Is there anyway to access injected service instance out of box?

Posted by Jim O'Callaghan <jc...@yahoo.co.uk>.
I forgot to put:

HttpSession session = req.getSession(false); 

... in the code below.  Anyhoo just saw "static" in your original query -
not sure if this is what you require.

Regards,
Jim.

-----Original Message-----
From: Jim O'Callaghan [mailto:jc1000001@yahoo.co.uk] 
Sent: 29 June 2010 15:17
To: 'Tapestry users'
Subject: RE: Is there anyway to access injected service instance out of box?

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:jaeluh@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 <ja...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


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


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


RE: Is there anyway to access injected service instance out of box?

Posted by Jim O'Callaghan <jc...@yahoo.co.uk>.
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:jaeluh@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 <ja...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


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


Re: Is there anyway to access injected service instance out of box?

Posted by "Jimmy.Lew" <ja...@aol.com>.
You mean like this:

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

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 <ja...@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-out-of-box--tp29020920p29020920.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@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-out-of-box--tp29020920p29023334.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Is there anyway to access injected service instance out of box?

Posted by Christophe Cordenier <ch...@gmail.com>.
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 <ja...@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-out-of-box--tp29020920p29020920.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Regards,
Christophe Cordenier.

Committer on Apache Tapestry 5
Co-Creator of wooki @wookicentral.com