cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: XSP (minus Cocoon plus SAX) success story
Date Wed, 26 Jan 2000 11:58:58 GMT
Ben Laurie wrote:
> 
> Mike Williams wrote:
> >
> > Hiya ... I'm new to the list, though I've been following Cocoon
> > developments on and off for the last year.
> >
> > For the past month or so, I've been developing an processor to produce
> > web-pages from XML templates.  My servlets handle requests, construct a Map
> > full of data to be merged into the output, and use templates to produce a
> > result-page.  The template resolver walks a DOM tree, and use FESI
> > ECMAScript to resolve merge-data expressions.  The output is a stream of
> > SAX events.
> >
> > Then last week, I saw the XSP stuff in Cocoon-1.6, and the penny
> > dropped. Way cool!  I've now written an XSL stylesheet that tranforms an
> > XSP page into a Java template; again, input is a Map of merge-data, and
> > output is SAX.
> >
> >   Build-time:
> >     {XSP} -> XSL(xsp) -> {template source} -> compile -> {template class}
> >
> >   Run-time:
> >     {data Map} -> template -> {SAX} -> formatter -> {HTML}
> >
> > There's no Cocoon code here: our pages are highly dynamic, so caching them
> > is not really an option.  We don't do any XSL transformation of the output
> > either ... it's all done before the XSP step, so that all the layout ends
> > up coded in Java as SAX events-calls.
> >
> > Anyway, the result is blinding fast: about 10 times the performance of my
> > original template interpreter!  Many, many thanks to Stefano, for
> > conceiving XSP, and Ricardo, for demonstrating how to implement it.  I'd
> > love to contribute my code to Cocoon, if it's at all useful ... just let me
> > know where to send it.
> 
> Sounds very interesting, but if it doesn't use Cocoon, presumably it
> belongs under some other part of the XML tree? I dunno, perhaps Cocoon
> should spread to encompass it?

Ehmmm, not to rain on the parade, but what's the point of doing this?

I mean, let's take a look at what you're doing:

> >   Build-time:
> >     {XSP} -> XSL(xsp) -> {template source} -> compile -> {template class}

You use XSP to compile your page into a java class. I presume this class
is not a cocoon producer, so it must be a servlet or a class called by a
servlet, right? Ok, let's move on...

> >   Run-time:
> >     {data Map} -> template -> {SAX} -> formatter -> {HTML}

This class interprets some data and spits SAX events that get formatted
in HTML. No cache, no post processing, nothing.

So, a quick and fast optimization would be

 Run-time:
       {data Map} -> template -> {HTML}

Why do you care spitting SAX events if nobody is processing them rather
than the formatter? just output HTML and you're done.

Ok, so, what have we got here? JSP with another syntax. A quick and
dirty way of doing the same thing without any Cocoon code

 XSP -> (xslt) -> JSP -> tomcat -> HTML

if you like XSP syntax better, or simply

 JSP -> tomcat -> HTML

if you care about compiled server pages only.

NOTE: I base this elaboration on your message, so I might well miss a
very significant point, please tell me if it is so.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message