You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jasha Joachimsthal <j....@onehippo.com> on 2010/01/13 13:13:25 UTC

Re: Question regarding zip serializer (filename becomes xxxx.continue)

Hi Robby,



2009/12/15 Robby Pelssers <ro...@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


Re: Question regarding zip serializer (filename becomes xxxx.continue)

Posted by Thomas Markus <t....@proventis.net>.
Hi,

Am 13.01.2010 13:13, schrieb Jasha Joachimsthal:
> 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>
>
>   

and check correct quotes and encoding (if needed). see
http://tools.ietf.org/html/rfc2183
Especially IE has some disadvantages with incorrect filenames.


regards
Thomas

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


Re: Question regarding zip serializer (filename becomes xxxx.continue)

Posted by Jasha Joachimsthal <j....@onehippo.com>.
2010/1/13 Robby Pelssers <ro...@ciber.com>:
> 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.

I saw the other post later :-) Both do the same: set a response header
"Content-Disposition".

Jasha

> Cheers,
> Robby
>
>
> -----Original Message-----
> From: Jasha Joachimsthal [mailto:j.joachimsthal@onehippo.com]
> Sent: Wednesday, January 13, 2010 1:13 PM
> To: users@cocoon.apache.org
> Subject: Re: Question regarding zip serializer (filename becomes xxxx.continue)
>
> Hi Robby,
>
>
>
> 2009/12/15 Robby Pelssers <ro...@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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

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


RE: Question regarding zip serializer (filename becomes xxxx.continue)

Posted by Robby Pelssers <ro...@ciber.com>.
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:j.joachimsthal@onehippo.com] 
Sent: Wednesday, January 13, 2010 1:13 PM
To: users@cocoon.apache.org
Subject: Re: Question regarding zip serializer (filename becomes xxxx.continue)

Hi Robby,



2009/12/15 Robby Pelssers <ro...@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


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