cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Henne <>
Subject [C2] Handling Redirects
Date Fri, 15 Dec 2000 20:02:33 GMT
Hi all,

we have found using HTTP redirects from C2 to be a thorny issue. Using
HttpServletResponse.sendRedirect() the redirect can be initiated, just like,
for instance, the XSPResponseHelper does. However, sending a redirect is only
possible until some output has been generated and flushed down the HTTP
Considering C2's pipelined architecture, I conclude that sending redirects is
only safe while, from the XSPGenerator's point of view, startDocument nas not
been called. Now here's the problem: there is no way to force code from a
logicsheet to be executed before contentHandler.startDocument() is called in
the generated XSP class. To fix this problem, I suggest modifications along
the lines of the patch you'll find below.
Another (minor) problem with redirects is the fact, that there is no (clean)
way for xsp code to stop the processing of the current document after a
redirect has been sent. This causes unnecessary resource use.

What the patch does:
- xsp-logicsheets may now include the new tag <xsp:init> within the context of
a logicsheet xsl:template-match. Code enclosed within these tags will be
placed at the very top of the xsp generator class's generate() method.

- it adds the exception type PageRedirectException which is a subclass of
ProcessingException. PageRedirectExceptions can carry redirect target

- it allows the generated xsp generator's generate() method to throw

- it adds the handling of PageRedirectExceptions to
ResourcePipeline.process(). A ProcessingException is thrown when a redirect is
tried from within an environement that is not an HttpEnvironement.

Joerg Henne
View raw message