Anders Lindh wrote:
>
> >One of the issues is technical in nature. Because of the SAX stream
> approach
> >that Cocoon 2 uses, the XSP page is being serialized AS it is being parsed.
> >What is happening is that each SAX event (startDocument, startElement,
> etc),
> >is being propogated through the entire SAX chain and being transformed as
> they
> >are called. Once the root element has been propogated, there is no turning
> >back.
>
> Ok.. Could you clarify a bit how and in what order things are done in
> Cocoon. What
> exactly does Cocoon do with a xsp page (that has been compiled into a java
> class)? The
> compiled java class constructs a SAX document, which in turn is XSLT
> processed if needed. Right?
> Isn't this the basic flow of things?
Yes. The key difference between DOM based Cocoon 1 and SAX based Cocoon 2
is the way information travels from generator to transformer to serializer
(or equivalent in Cocon 10. In Cocoon 1, the DOM is created and manipulated
before being passed to the next step (i.e. redirects are possible because
nothing has passed from the "pipeline" to the serializer yet. In fact, in
Cocoon 1 you can perform redirects at any stage before the final serialization.
There is nothing technical keeping you from it. It is also why it tends to
be much slower than Cocoon 2.
SAX based Cocoon 2 fires events which are propogated through the pipeline
as the document is processed. This means that the event is fired first
in the Generator (your XSP), and then in each successive Transformer, and
finally in the Serializer.
XSP flow does not start until you have your document's root element. That
means that any <xsp:logic/> sections that are outside of the root element
become class variables or methods. It also means that the root startElement()
event is fired before any code is executed. In a generator, the only safe
place to do a redirect is in the setup() method. XSP does not give you access
to that (unless you took advantage of your knowledge of how the generated
class behaves). It is never safe to perform a redirect in a Transformer
with Cocoon 2.
S/MIME Cryptographic Signature