PROBLEM #1: Redirect to error page. cocoon.redirectTo(): http://cocoon.apache.org/2.1/userdocs/flow/api.html#N10165 The second parameter may be useful to you: - True forces the redirect to the browser. - False tells Cocoon to display a different page without telling the browser.
PROBLEM #2: Get the context URL: Variables in Lenya-1.2: http://solprovider.com/lenya/variablescommon Using the first three portions may cause problems when changing platforms. Some variables include the servlet name "\lenya" when running on Tomcat and exclude it with Jetty. page-envelope:context-prefix was probably designed for what you want but includes the document-path (bug?). The request:requestURI before the page-envelope:document-id is probably best. FlowHelper is not needed. --- SOLUTION: <map:call function="error"> <map:parameter name="docid" value="{page-envelope:document-id}"/> </map:call> function error(){ var currentURL = cocoon.request.getRequestURI(); var docid = cocoon.parameters.docid; var endpos = currentURL.indexOf(docid); var errorURL = "/error.html"; if(endpos > 0) errorURL = currentURL.substring(0, endpos); cocoon.response.setStatus(406); cocoon.redirectTo(errorURL, true); } WARNING: This code was written directly into this post and has not been tested. solprovider On 1/16/08, stevecam <[EMAIL PROTECTED]> wrote: > >> I have some flowscript that I am using to control display order of lenya > >> pages. > >> > >> I want to redirect to an error page and I want to pass an absolute url to > >> the cocoon.redirectTo() method. > >> > >> Currently, it seems I can only set a path relative to the current request > >> (e.g '../error.html') for the site-map to process it correctly, or else, > >> use > >> an absolute uri (e.g 'http://localhost:8080/lenya/tlp/live/error.html'). > >> > >> Out of interest, is there simple way (one function call) to obtain the > >> part > >> of the uri up to and including the 'area' (live vs authoring) using the > >> FlowHelper? > Lenya version 1.2 > > I'm now just using a simple routine as follows: > function GetURIRoot(){ > var helper = new FlowHelper(); > var bits = helper.getRequestURI(cocoon).split("\/"); > return "/" + bits[1] + "/" + bits[2] + "/" + bits[3]; > } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
