You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2006/12/05 18:32:22 UTC
[jira] Updated: (COCOON-1963) Add a redirect action to the browser
update handler
[ http://issues.apache.org/jira/browse/COCOON-1963?page=all ]
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: http://issues.apache.org/jira/browse/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
> 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 BUHandler.js:
> <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: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira