cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Unico Hommes" <Un...@hippo.nl>
Subject redirect-to from sendPage
Date Sun, 01 Feb 2004 14:35:18 GMT

Given the following sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

  <map:flow language="javascript">
     <map:script src="flow.js"/>
  </map:flow>
  
  <map:pipelines>
    <map:pipeline>
      
      <map:match pattern="test">
        <map:call function="sendPageWithRedirect"/>
      </map:match>
      
      <map:match pattern="redirect">
        <map:redirect-to uri="success"/>
      </map:match>
      
      <map:match pattern="success">
        <map:read src="sitemap.xmap"/>
      </map:match>
      
    </map:pipeline>
  </map:pipelines>
</map:sitemap>

... and the following flowscript:

function sendPageWithRedirect() {
  cocoon.sendPage("redirect",null)
}


requesting 'test' will return an empty page to the browser.

The reason that this does not work is because the flow interpreter
implements sendPage as any other internal request.

Now, please correct me if I am wrong, but I tend to think that it should
be possible to do a sendPage to a redirect-to and that therefore the
current behavior is buggy. Because, whereas calling a sitemap source
using the cocoon: protocol obviously should not cause the client to
redirect, this is not so obvious to me in case of a sendPage because the
pipeline that is called here is top-level from the perspective of the
flow script.

If I consider this from the point of view of nested Environment objects,
I don't see a reason for the sendPage Environment to stop the redirect
call from reaching the client.

I've run into this problem in the past, and at least one person on the
users list has also. We need to decide what stance we take on this and
either fix it or document it properly.

WDYT?

Unico

Mime
View raw message