cocoon-dev mailing list archives

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

Alexander Klimetschek updated COCOON-1963:

    Attachment: BUHandler.js

Not a patch, but the entire new version of BUHandler.js (sorry, but I currently don't have
the environment to test it out directly in cocoon-ajax)

> Add a redirect action to the browser update handler
> ---------------------------------------------------
>                 Key: COCOON-1963
>                 URL:
>             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
>         Attachments: BUHandler.js
> 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
>     <bu:document>
>         <bu:redirect uri="foobar42" />
>     </bu:document>
> 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" />
>         </when>
>     </select>
> The server-side javascript snippet for the save action should look like (form is the
Form object and documentID="foobar42"):
>     if (newDocument) {
>         form.getWidget().endProcessing(false);
>         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