cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <>
Subject How do I create a context from a background task in cocoon?
Date Tue, 06 Dec 2005 14:00:31 GMT
Does anybody have experience with calling a pipeline from a background task resulting from
an eventHandler?

So, on an event, a java class is executed which implements Contextualizable.

I am trying something like 

import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;

    implements Contextualizable, ...

    private Context context;

    public void contextualize(Context context) throws ContextException {
        this.context = context;

PipelineUtil pipeUtil = new PipelineUtil();
try {
    pipeUtil.processToSAX(uri, null, somehandler);
} catch (Exception e) {
    throw new CascadingRuntimeException("Cannot process pipeline from '" + uri + "'", e);
} finally {

Now, this does not work, because it does not have a context, since the class is not called
from a sitemap but from an external event.

So, I tried instead of with the context, the SourceResolver, like

SourceResolver resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);

and then something like 
Source inputSource = resolver.resolveURI("cocoon://dasl/references/content/test/Passage.xml");

But, nothing happens, I suppose because the cocoon:// is only available when the call is initiated
from a sitemap (or flow of course)

So, does anybody know how to solve this/solved this before? 



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

View raw message