You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by Apache Wiki <wi...@apache.org> on 2005/04/16 14:47:41 UTC

[Cocoon Wiki] Update of "SavingFilesToFileSystem" by SylvainWallez

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change notification.

The following page has been changed by SylvainWallez:
http://wiki.apache.org/cocoon/SavingFilesToFileSystem

The comment on the change is:
Internal pipelines don't need to be noncaching

------------------------------------------------------------------------------
  == Introduction ==
  Suppose we need to save a PDF file to the file system instead of sending it to the user's browser. I will explain later why we would need this.
  
- The Source``Writing``Transformer could be used for this, but here we describe a more "modern" solution using the ''cocoon.processPipelineTo'' method from flowscript, to save the result of a pipeline to a file.
+ The Source``Writing``Transformer could be used for this, but pipeline components having side effects aren't considered to be a good practice. So we describe here a more "modern" and correct solution using the ''cocoon.processPipelineTo'' method from flowscript, to save the result of a pipeline to a file.
  
  == Process ==
   * Open the "sitemap.xmap" for "blablabla" directory and create a usual pipeline that creates PDF files from XML files. You can use any XML file and any XSL-FO stylesheet from Cocoon package. Bind it to some abstract extension, for example "*.do".
  {{{
- <map:pipeline internal-only="false" type="noncaching">
+ <map:pipeline internal-only="false">
    <map:match pattern="**/*.do">
      <map:generate src="{1}/{2}.xml"/>
      <map:transform src="convert.xsl" label="content">
@@ -80, +80 @@

  
   * After debugging the script and the pipeline, make the pipeline invisible to the browser by setting:
  {{{
- <map:pipeline internal-only="true" type="noncaching">
+ <map:pipeline internal-only="true">
  }}}
  
  == Points of further improvement ==