cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jasha Joachimsthal <j.joachimst...@onehippo.com>
Subject Re: Question regarding zip serializer (filename becomes xxxx.continue)
Date Wed, 13 Jan 2010 12:13:25 GMT
Hi Robby,



2009/12/15 Robby Pelssers <robby.pelssers@ciber.com>:
> 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

j.joachimsthal@onehippo.com - jasha@apache.org

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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message