cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Markus <t.mar...@proventis.net>
Subject store contents of a pipeline
Date Tue, 27 Jan 2009 14:19:08 GMT
hi all,

i try to cache the output from a sitemap (and i cant use cached 
pipelines). this sitemap returns only generated content (html and 
images). i created an action thats verifies my cache and calls an uri to 
store pipeline output.  my applications works fine without this action.

it "works" but i have 2 problems:
- html content is parsed as xml. my original pipeline has a <serialize 
type="html" /> but content is in xml (with <?xml?> header and entities). 
binary content like images are ok
- property mimetype from source is always empty (see java part below)

how can i access the correct content and mimetype? system is cocoon 2.1.7

regards
thomas

<!--pipeline -->
<map:pipelines>

    <map:pipeline internal-only="true">
        <map:match pattern="**">
            <map:mount uri-prefix="" src="../sitemap.xmap" />
        </map:match>
    </map:pipeline>

    <map:pipeline>
        <map:match pattern="**">            
            <map:act type="checkcache" src="cocoon:/{1}">
                <map:read src="{file}" mimetype="{mimetype}" />
            </map:act>
            <map:mount uri-prefix="" src="../sitemap.xmap" />
        </map:match>
    </map:pipeline>

</map:pipelines>


/* action snippet */
Source src = resolver.resolveURI(source);
try {
    FileOutputStream out = new FileOutputStream(file);
    try {
        InputStream in = src.getInputStream();
        IOUtil.copy(in, out);
    } finally {
        out.close();
    }
    // this is never correct!
    src.getMimeType();
} finally {
    resolver.release(src);
}


Mime
View raw message