You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ben Anderson <be...@gmail.com> on 2005/01/06 12:39:32 UTC

Redirector

Hi,
I've written a custom action like this:

public class RedirectorAction extends AbstractAction {

    public Map act( Redirector redirector, 
                    SourceResolver resolver, 
                    Map objectModel, 
                    String source, 
                    Parameters parameters ) {
        try {
            Request request = (Request)objectModel.get("request");
            String referrerURI = request.getParameter("referrerURI");
            redirector.redirect(false, referrerURI);

The reason I wrote this is because I have a pipeline which I want to
execute some db updates via the sqltransformer.  But then I want to
redirect that pipeline to another pipeline based on a hidden parameter
I've kept in a form.  The problem I'm having is that when this action
runs, the sqltransformer (which is above it in the pipeline) doesn't. 
It's like the redirector.redirect() method cancels everything that was
happening.  I noticed this because when I use a view which exits the
pipeline right before this action, it works fine.  Is there a way to
get around this?  I want to issue a redirect to the client, but
process the pipeline as normal on the serverside.

Thanks,
Ben

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


Re: Redirector

Posted by Joerg Heinicke <jo...@gmx.de>.
On 06.01.2005 12:39, Ben Anderson wrote:

> The reason I wrote this is because I have a pipeline which I want to
> execute some db updates via the sqltransformer.  But then I want to
> redirect that pipeline to another pipeline based on a hidden parameter
> I've kept in a form.  The problem I'm having is that when this action
> runs, the sqltransformer (which is above it in the pipeline) doesn't. 
> It's like the redirector.redirect() method cancels everything that was
> happening.  I noticed this because when I use a view which exits the
> pipeline right before this action, it works fine.  Is there a way to
> get around this?  I want to issue a redirect to the client, but
> process the pipeline as normal on the serverside.

Actions are part of the pipeline setup and are executed before pipeline 
execution. You can try flow using processPipelineTo*() and after 
processing your pipeline with SQLTransformer you can redirect.

Joerg


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