Vadim Gritsenko wrote:

Sylvain Wallez wrote:

Vadim Gritsenko wrote:

Sylvain Wallez wrote:

Moreover, you may consider the case of complex pipelines where the actual template depends on the user rights, target browser or whatever else. In that case, the cache information can be different depending on used template.



And for caching to play right with proxies and browsers, Vary header (and/or some others) should be set. What mechanism can be used to set headers from the JX template?



<jx:var name="foo" value="cocoon.request.setHeader('bar', 'baz')"/> ??



Thought a bit about it... Due to streaming nature of the Cocoon (forget for a second that pipeline's default behavior is to buffer output - default can be changed anyway), this won't work. First startElement() event corresponding to root element is already out, and, under ideal conditions, already written to the output stream.


Thus, this will fail.


You're right. Also, if the pipeline is cached, headers aren't set again. Headers must actually be set in setup().

The only other option I see is to mimic XSP page structure: Introduce root <jx:page/> tag which is *not* printed to the output. Then, everything between the <jx:page/> and first SAX event can perform whatever setup operations needed.


That additional root tag is something I dislike in XSP. Furthermore, a valid JX template may not contain any <jx:*> element if only expression expansion is used. Adding an additional mandatory root tag breaks this simplicity.

Don't know... what about some <jx:header> statements that would be allowed only as children of the root element and executed in setup()?

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to