Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 21364 invoked from network); 18 Nov 2005 04:27:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Nov 2005 04:27:06 -0000 Received: (qmail 33827 invoked by uid 500); 18 Nov 2005 04:21:49 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 28460 invoked by uid 500); 18 Nov 2005 04:21:07 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 21163 invoked by uid 99); 18 Nov 2005 04:18:36 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 17 Nov 2005 20:16:12 -0800 Received: (qmail 7809 invoked by uid 65534); 18 Nov 2005 04:15:27 -0000 Message-ID: <20051118041527.7808.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r345438 [134/286] - in /cocoon/site/site/2.1: ./ developing/ developing/portal/ developing/portal/coplets/ developing/webapps/ developing/webapps/authentication/ faq/ howto/ installing/ plan/ plan/documentation/ plan/otherplanning/ plan/ove... Date: Fri, 18 Nov 2005 04:13:22 -0000 To: cvs@cocoon.apache.org From: crossley@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: cocoon/site/site/2.1/userdocs/core/resource-reader.html URL: http://svn.apache.org/viewcvs/cocoon/site/site/2.1/userdocs/core/resource-reader.html?rev=345438&view=auto ============================================================================== --- cocoon/site/site/2.1/userdocs/core/resource-reader.html (added) +++ cocoon/site/site/2.1/userdocs/core/resource-reader.html Thu Nov 17 20:00:02 2005 @@ -0,0 +1,1676 @@ + + + + + + + +ResourceReader in Cocoon + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + +
+
+
+
+ +
+ + +
+ +
+ +   +
+ + + + + +
+

ResourceReader in Cocoon

+ +

ResourceReader

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

NAME

+ +
+ +

resource

+ +
+ +

WHAT

+ +
+ +

The ResourceReader component is used to serve binary data in a +sitemap pipeline.

+ +
+ +

TYPE

+ +
+ +

Reader, Sitemap Component

+ +
+ +

BLOCK

+ +
+ +

Core

+ +
+ +

CLASS

+ +
+ +

org.apache.cocoon.reading.ResourceReader

+ +
+ +

SINCE

+ +
+ +

Cocoon 2.0

+ +
+ +

CACHEABLE

+ +
+ +

yes

+ +
+
+ +

Description

+
+

The ResourceReader component is used to serve binary data in a +sitemap pipeline.

+
+ +

Usage

+
+ +

Sitemap pipeline examples

+

The ResourceReader is used in a pipline as shown in the pipeline +snippet below:

+
+<map:match pattern="*.css">
+  <map:read type="resource" 
+    src="resources/styles/{1}.css" 
+    mime-type="text/css">
+    <!-- option sitemap parameters -->
+    ...
+  </map:read>
+</map:match>
+
+

It is important to specify the mime-type attribute, as it is passed +to the browser as the Content-Type in the HTTP response.

+ +

Sitemap component configuration example

+

A ResourceReader is declared in the sitemap readers section, as +shown in the sitemap readers snippet below:

+
+<map:readers default="resource">
+  <map:reader name="resource" 
+    src="org.apache.cocoon.reading.ResourceReader" 
+    logger="sitemap.reader.resource" 
+    pool-max="32"/>
+    <!-- optional reader configuration -->
+    ...
+  </map:readers>
+...
+        
+ +

Configuration

+

The ResourceReader accepts the following configuration parameters: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

Parametername

+ +
+ +

Type

+ +
+ +

Comment

+ +
+ +

expires

+ +
+ +

Time in milliseconds

+ +
+ +

This parameter is optional. When specified it determines how long in +miliseconds the resources can be cached by any proxy or browser between Cocoon2 +and the requesting visitor.

+ +
+ +

quick-modified-test

+ +
+ +

boolean

+ +
+ +

This parameter is optional. This boolean parameter controls the last modified +test. If set to true (default is false), only the last modified of the current +source is tested, but not if the same source is used as last time.

+ +
+ +

byte-ranges

+ +
+ +

boolean

+ +
+ +

This parameter is optional. This boolean parameter enables or disables +support for the byte ranges. By default this parameter is set to true.

+ +
+ +

buffer-size

+ +
+ +

integer

+ +
+ +

This parameter is optional. It specifies the buffer/block size when reading +from a resource. By default this parameter is set to 8192.

+ +
+

The following ResourceReader declaration snippet configures the +default reader for having an expiration of 1 day (ie. 24 * 60 * 60 * 1000 ms = +86400000 ms)

+
+<map:readers default="resource">
+  <map:reader name="resource" 
+    src="org.apache.cocoon.reading.ResourceReader" 
+    logger="sitemap.reader.resource" 
+    pool-max="32"/>
+    <!-- optional reader configuration -->
+    <parameter name="expires" value="86400000"/>
+  </map:readers>
+...
+        
+ +

Setup

+

The ResourceReader accepts following sitemap setup parameters that +override the configuration settings:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +

Parametername

+ +
+ +

Type

+ +
+ +

Comment

+ +
+ +

expires

+ +
+ +

Time in milliseconds

+ +
+ +

This parameter is optional. When specified it determines how long in +miliseconds the resources can be cached by any proxy or browser between Cocoon2 +and the requesting visitor.

+ +
+ +

quick-modified-test

+ +
+ +

boolean

+ +
+ +

This parameter is optional. This boolean parameter controls the last modified +test. If set to true (default is false), only the last modified of the current +source is tested, but not if the same source is used as last time.

+ +
+ +

byte-ranges

+ +
+ +

boolean

+ +
+ +

This parameter is optional. This boolean parameter enables or disables +support for the byte ranges. By default this parameter is set to true.

+ +
+ +

buffer-size

+ +
+ +

integer

+ +
+ +

This parameter is optional. It specifies the buffer/block size when reading +from a resource. By default this parameter is set to 8192.

+ +
+

The following ResourceReader declaration snippet parameterizes the +default reader for having an expiration of 1 day (ie. 24 * 60 * 60 * 1000 ms = +86400000 ms)

+
+  <map:read src="images/picture.gif"/>
+    <map:parameter name="expires" value="86400000"/>
+  </map:read>
+...
+        
+ +

Effect on Object Model and Sitemap Parameters

+

The ResourceReader does not change object model and sitemap +parameters. It only access values for reading.

+
+ +

Bugs/Caveats

+
+ +

History

+
+

12-25-02: Initial document creation by Bernhard Huber
+01-06-03: Added new parameters and byte range support, Torsten Curdt

+
+ +

See also

+
+ +
+
+ +
 
+
+ + + Propchange: cocoon/site/site/2.1/userdocs/core/resource-reader.html ------------------------------------------------------------------------------ svn:eol-style = native