cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robby Pelssers <Robby.Pelss...@nxp.com>
Subject RE: pipeline component
Date Thu, 08 Mar 2012 12:16:02 GMT
Hi Jos,

I know you're using C3.  But your requirements are not yet completely clear to me. 

So the user fills in some form and on submit some pipeline is invoked that generates some
report. Is that report XML, PDF, or plain XHTML?
And instead of sending that report to the browser you want it zipped?

I don't think you need any special component to do so. At least not in C2.2. Not sure if the
ZipSerializer is already available in C3 but let's assume it is.

You can use a combination of the zipserializer and the cinclude transformer to generate the
report and insert it as an entry.  I will explain using jxtemplate generator but I think you
can switch to using StringTemplate generator.


Suppose this file is report.jx
<?xml version="1.0" encoding="UTF-8"?>
<zip:archive 
  xmlns:zip="http://apache.org/cocoon/zip-archive/1.0"
  xmlns:cinclude="http://apache.org/cocoon/include/1.0">
  <zip:entry name="${customer}.xml">
    <!-- assume your report is some xml file -->
    <cinclude:include src="cocoon://report/${customer}.xml"/>
  </zip:entry>
</zip:archive>


The sitemap could look like this:

<!--
 | {1}: customer-id
 -->
<map:match pattern="report2zip/*">
  <map:generate src="jx/report.jx" type="jx">
    <map:parameter name="customer" value="{1}"/>
  </map:generate>
  <map:transform type="cinclude"/>
  <map:serialize type="zip"/>
</map:match>

Hope this comes close to what you need.

Robby

-----Original Message-----
From: Jos Snellings [mailto:Jos.Snellings@pandora.be] 
Sent: Thursday, March 08, 2012 11:45 AM
To: users@cocoon.apache.org
Subject: pipeline component

Hi !

Question:
*  a web form controls the generation of a report
* the report comes as a .zip  download

What sitemap component should be created for this report generator?
(in fact it should be a single component, like map:read)
- set headers
- write zip output to response.getOutputStream

Thanks,
Jos

---------------------------------------------------------------------
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


Mime
View raw message