tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Cocoon interceptor inside Tomcat?
Date Wed, 20 Sep 2000 16:56:56 GMT
See below.

Jonas Bosson wrote:

> Hello!
>
> I'm starting to investigate the possibility of creating a cocoon
>  interceptor in tomcat.
>
> This would:
> * enable XML from dynamic content / servlets (pipe to formatter)
> * use features in IE5/XML-browser and at the same time produce
>    html to other browsers
> * greatly improve XML possibilities
>
> Work needed:
> * Intercept output stream at beforeBody (if type=xml/type -> change
>   output to a buffer) actually before any headers have been sent,
>   since we might want to change content type.
>   (possibly intercept at setContentType?)
>
> * Read the buffer instead of the XML file in Cocoon and set the
>   response output to the output of the intercepted app.
>
> Has this been done/are any work in progress?
> Another option is to create the same in Apache, but that would
> include a rewrite of cocoon into C/C++.
>

The RequestInterceptor architecture in Tomcat 3.2 isn't really set up to
intercept the output stream in the way you would need to do this easily.
You can change the headers in the beforeBody() entry point, but it's
difficult to replace the output stream itself unless you build a custom
Response implementation further up the request processing pipeline and
modify the connectors to use your implementation instead.

In Tomcat 4.0 (i.e. Catalina) the Valve approach lets you wrap the
response before passing it on to the next object in the pipeline, so this
is much easier.  However, if you're going that way I would strongly
suggest that you create a javax.servlet.Filter implementation (new
feature in the 2.3 servlet spec) instead.  One of the design goals of
filters was to make precisely this kind of thing possible.  That way,
your Cocoon interceptor would be portable to any 2.3 servlet container,
instead of being specific to Tomcat.

>
> best regards,
> Jonas, IllumiNet
>

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Mime
View raw message