cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: DAOSecurityHandler
Date Mon, 18 Aug 2008 06:28:21 GMT
On 06.08.2008 02:30, Robin Rigby wrote:

> I am looking for the Java equivalent of the JavaScript
> var parser =
> cocoon.getComponent(;
> and the same for SourceResolver.
> Sitemap components seem to get them from an Avalon ServiceManager and I
> found a thread 
> suggesting to copy from ContainerTestCase.  Is there not a simpler way?

Hi Robin,

you need indeed a ServiceManager to retrieve the components as follows:

DOMParser domParser;
try {
   domParser = serviceManager.lookup(DOMParser.Role);
   // do something with the DOMParser
} catch (ServiceException e) {
} finally {

It depends on your use case if you can release the DOMParser instance 
immediately in the finally block or want to keep it and release it for 
example in a recycle method.

And: The Java code needs access to a Service Manager what means more or 
less that it has to be a Avalon component itself.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message