Hey Joachim,
Thx for the 2 tips.... I will definitely follow up on your advice. You probably
also read the reply on this thread of another solution I found for setting the
header:
var response = cocoon.response;
response.setHeader(
"Content-Disposition",
"attachment; filename=" + productId + ".zip"
);
cocoon.sendPage(
"gif/" + productId + ".zip",
{
"data": viewData2
}
);
But reading your mail I might lean toward your solution.
Cheers,
Robby
-----Original Message-----
From: Jasha Joachimsthal [mailto:[email protected]]
Sent: Wednesday, January 13, 2010 1:13 PM
To: [email protected]
Subject: Re: Question regarding zip serializer (filename becomes xxxx.continue)
Hi Robby,
2009/12/15 Robby Pelssers <[email protected]>:
> Hi all,
>
>
>
> I've setup some Pipelines which transform some xml documents into DITA
> format. So what I and up with is a <map> and several <topic>'s.
>
>
>
> The user should be able to render a html preview or download the DITA result
> fragments as zip-file.
>
>
>
> So in my flowscipt I check which submitbutton the user hits and dynamically
> determine the pipeline which needs to get invoked:
>
> var view =
>
> submitId.equals("viewXML")
>
> ? "datasheetContainer"
>
> : productId + ".zip";
>
>
>
> //generate xml snippet which lists the selected topics and start the
> complete datasheet process from there
>
> cocoon.sendPage(
>
> view,
>
> {
>
> "data": viewData2
>
> }
>
> );
>
>
>
>
>
> My relevant sitemap snippets:
>
> <map:match pattern="datasheetContainer">
>
> <map:generate src="data/datasheet.jx" type="jx" label="step-1"/>
>
> <map:transform type="cinclude" label="step-2"/>
>
> <map:transform src="xslt/includePackageAndProductXml.xslt"
> label="step-3"/>
>
> <map:transform type="cinclude" label="step-4"/>
>
> <map:transform src="xslt/addGroupId.xslt" type="saxon"
> label="step-5"/>
>
> <map:transform src="xslt/createMapAndTopics.xslt" type="saxon"
> label="step-6"/>
>
> <map:transform src="xslt/sortNonQuantitativeTables.xslt"/>
>
> <map:transform type="cinclude" label="step-7"/>
>
> <map:transform src="xslt/replaceBoxDimensions.xslt" type="saxon"
> label="step-8"/>
>
> <map:transform src="xslt/mergeParametricTableCells.xslt"
> type="saxon" label="step-9"/>
>
> <map:transform src="xslt/cleanup.xslt" type="saxon"/>
>
> <map:transform src="xslt/escapeHtml.xslt" type="saxon"/>
>
> <map:serialize type="productxml"/>
>
> </map:match>
>
>
>
> <map:match pattern="*.zip">
>
> <map:generate src="cocoon://datasheetContainer"/>
>
> <map:transform src="xslt/datasheet2zip.xslt" type="saxon"
> label="zip"/>
>
> <map:serialize type="zip"/>
>
> </map:match>
>
>
>
> The problem I am facing is that the download dialogue now pops up with
>
> U have chosen to download the file xxxyyyyzzzz.continue
>
>
>
> But what I wanted was PH3330L.zip for example.
>
>
>
> Anyone who knows if I can change this behaviour somehow?
Yes, use the set-header action
In map:components
<map:actions>
<map:action name="set-header" logger="sitemap.action.set-header"
src="org.apache.cocoon.acting.HttpHeaderAction"/>
</map:actions>
In the map:pipeline
<map:match pattern="*.zip">
<map:act type="set-header">
<map:parameter name="Content-Disposition"
value="attachment;
filename={1}.zip"/>
</map:act>
BTW you're doing 3 includes inside the datasheetContainer pipeline.
It's better to split that one up into 3 pipelines with 1 include each
(you'll notice when you measure the response times).
Regards
Jasha Joachimsthal
[email protected] - [email protected]
www.onehippo.com
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
San Francisco - Hippo USA Inc. 185 H Street, suite B, Petaluma CA
94952 +1 (707) 7734646
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]