cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Klimetschek (JIRA)" <>
Subject [jira] Created: (COCOON-1963) Add a redirect action to the browser update handler
Date Tue, 05 Dec 2006 17:30:21 GMT
Add a redirect action to the browser update handler

                 Key: COCOON-1963
             Project: Cocoon
          Issue Type: New Feature
          Components: Blocks: Ajax
    Affects Versions: 2.2-dev (Current SVN), 2.1.10-dev (current SVN)
            Reporter: Alexander Klimetschek

In some situations you want to redirect the browser to a different page inside a cforms action,
eg. you have a REST-style interface and create something under the URL /new (which shows a
form to enter your new data) and on save you want to redirect the user to a page where that
new data is stored (e.g. /foobar42). To do so in an ajax-environment, where the save action
will be answered with a browser-update XML snippet, you need a separate action in the browser
update handler. This patch adds the handling of a simple "redirect" action to the BUHandler.js:

        <bu:redirect uri="foobar42" />

If you want to have a fallback solution for non-AJAX cases, you need to trigger a normal HTTP
redirect from your pipeline. This must happen when this bu:redirect is inside the XML stream,
otherwise all content should be serialized to the browser. That functionality is provided
by the attached RedirectTransformer. The usage would be like:

    <select type="ajax-request">
        <when test="false">
            <transform type="redirect" />

The server-side javascript snippet for the save action should look like (form is the Form
object and documentID="foobar42"):

    if (newDocument) {
        cocoon.redirectTo("cocoon:/redirectTo/" + documentID);

There should be a pipeline that matches "/redirectTo/*" and that serves the bu:document like
above (eg. via a jx template to insert the documentID).

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message