You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Emond Papegaaij <em...@emaxx.nl> on 2004/07/06 13:01:47 UTC
Accessing services
Hello,
I've created my own Serviceable object. It is registered from cocoon.xconf,
however, how do I access this service? I need access from the following parts
of the code:
- sitemap
- javascript flow
- xsp
- custom java objects
At this moment I put the Serviceable object in a static field to access it
from anywhere, but I don't like this solution and I assume there's a better
way to do it.
This Servicable also uses the SessionManager. Is it safe to assume that the
SessionManager will always be present in the ServiceManager provided to my
Serviceable?
Best regards,
Emond Papegaaij
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Accessing services
Posted by Stephan Coboos <cr...@gmx.net>.
Emond Papegaaij wrote:
>Hello,
>
>I've created my own Serviceable object. It is registered from cocoon.xconf,
>however, how do I access this service? I need access from the following parts
>of the code:
>- sitemap
>
>
?? Eventually an own action?
>- javascript flow
>
>
cocoon.getComponent(<Role>)
cocoo.releaseComponent(<Role>)
>- xsp
>
>
With method service or compose? I don't know which one is now
implemented in XSP.
Note: ComponentManager (ServiceManager?) is already imported.
>- custom java objects
>
>
Write your own method? But:
You should never throw a component thru other objects because of
closing it correctly can be a problem!
The best way ist to get the component, fetch all datas required and then
return it immediately after that. Only the required datas should be used
as arguments for other objects becuase you can fall into troubles if
you're using Poolable or ThreadSafe and not returning the component
correctly!
Regards
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org