cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tagunov Anthony" <atagu...@nnt.ru>
Subject Re: more text/plain output
Date Tue, 13 Mar 2001 08:24:46 GMT
On Mon, 12 Mar 2001 14:08:03 -0800, Cindy Ballreich wrote:

>
>A couple of days ago Jonathan Fuerth suggested using XSP to change the
>Content-Disposition header so that MSIE will accept text/plain output from
>an XML source. I wrote an XSP file that does this and it appears to work -
>at least with small amounts of XML. Using the XSP with my full XML file
>(which isn't really all *that* big) gives the following error...
>
>java.lang.ClassFormatError: Code of a method longer than 65535 bytes

I guess the reason is the following: all you put into .xml file that has 
<?cocoon-process type="xsp"?>
is compiled into one java method (look at the repository, if intrested!)

So too much code can not go there!
The solution for serving long files can be one of the following:
1) use XInclude. So your main file will look like
<?cocoon-process type="xsp"?>
<?cocoon-process type="xinclude"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href=".." type="text/xsl"?>
<xsp:page>
  <page>
     <xsp:logic>responce.setHeader..</xsp:logic>
     <include xinclude:href="real-file.xml" xinclude:parse="xml" xmlns:xinclude="..."/>
  </page>
</xsp:page>

This should work.

Are you using C1 or C2?

If you're using C1 then you gonna run in the following trouble:
-- if this page gets served from cache, then YOU WON'T HAVE
    YOU DESIRED HEADER!!
    (we here at www.nnt.ru tried to modify Page.java to store
     the headers, but the solution is far not elegent and in addition
     we fell behind the current cocoon version with our patched 
     files. The trouble is that you no longer can set headers with
     responce.setHeader(), you should do it via page.setHeader,
     but in an XSP page you can not get access to the Page
     object. So we could set our new headers only in 
     a processor. If i could find a way to do it in XSP then
     in the responce taglib we could update <responce:set-header/>
     (or whatever it is called there), but :-(((..)
So the only solution is to disable caching, that is _NOT_ put
<xsp:page>
<xsp:logic>boolean hasChanged(){ return true; }
boolean isCacheable(){ return true; }</xsp:logic>
but then, you know, it will run slowely, espcially
knowing that your files are large.

again we have developed some content aggregation
for C1 (xinclude-style), it has got caching: but again,
it is behind current versions of Cocoon and requires
heavy changes to many files..

>I expect that I'm going about this all wrong. All I really want to do is
>call response.setHeader and then copy the XML with new PIs pointing it to
>the proper  XSL file. This is the XSP that I've written...
>
><?xml version="1.0" encoding="UTF-8"?>
><xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>  <xsl:template match="/">
>    <xsl:processing-instruction
>name="cocoon-process">type="xsp"</xsl:processing-instruction>
>    <xsl:processing-instruction
>name="cocoon-process">type="xslt"</xsl:processing-instruction>
>    <xsl:processing-instruction
>name="xml-stylesheet">href="catalog-text.xsl"
>type="text/xsl"</xsl:processing-instruction>
>    <xsp:page xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>      <page>
>        <xsp:logic> 
>          response.setHeader("Content-Disposition", "inline;
>filename=kluge.txt");
>        </xsp:logic>
>        <xsl:apply-templates/>
>      </page>
>    </xsp:page>
>  </xsl:template>
>  <xsl:template match="@*|*|text">
>    <xsl:copy-of select="."/>
>  </xsl:template>
></xsl:stylesheet>
>
>I'd really appreciate any pointers that would get me heading in the right
>direction.
>
>Cindy
>
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
>To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
>For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>
>




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message