cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcelo F. Ochoa" <moc...@ieee.org>
Subject RE: Cocoon modification to give producers the access to HttpServletResponse
Date Thu, 13 Jul 2000 12:42:27 GMT

Hi, everyone.

I am sure many people involved in the developmnet of web applications using
Cocoon have run up against the inability to access an instance of an
HttpServletResponse object inside the producer code.
[>]  This was my first trouble in Cocoon 1.x.

This is a severe limitation, one that prohibits setting HTTP cookies,
sending redirects, streaming out binary files, etc.
[>]  In order to give this functionality to DB Prism Producer for Cocoon 1.x I developed
a Simple HeaderProcessor that permite to any producer change the header of response.
With this idea you could make a XML page like this:
<?xml version="1.0"?>
<?xml-stylesheet href="http://localhost/xsl/hello.xsl" type="text/xsl"?>
<?cocoon-process type="http"?>
<?http mode="Set-Cookie" spec="test=1; expires=Friday, 14-Jul-00 04:26:58 GMT;" ?>
<?cocoon-process type="xslt"?>
<page>
<title>Hello world</title>
<content>
<paragraph>This is my first Prism-Cocoon code with Cookies!</paragraph>
</content>
</page>
<!-- toolkit version 1.0.1 Author: Marcelo F. Ochoa "mochoa@ieee.org" -->

This page has http Pi tags that say to Header processor change HttpHeader with a new Cookie
definition. Others modes of operation permit send Redirect URL, Not Found, Expires, and so
on.
This isn't best way to solve the problem but its Work Fine.
HeaderProcessor only needs add a simple class to CLASSPATH (HeaderProcessor.class) and one
line to cocoon.properties file:
processor.type.http = com.prism.HeaderProcessor
You could find the source an examples at DB Prism home page http://www.plenix.com/dbprism/

I know that this functionality is available through XSP, but to use XSP in
conjunction with producers is, in my opinion, a contrived and inefficient
solution. (In addition, we have not been able to get it to work at all)

I have come up with what I consider to be a pretty simple, yet effective
modification to Cocoon that will allow producers to access the Servler
Response object without breaking the backwards compatibility with existing
producers, or going against the general Cocoon design model.
[>]  HeaderProcessor don't need Cocoon internals changes.



Thanks for your time.
[>]  Best regards, Marcelo. 

Mime
View raw message