ByteRangeResourceReader in Cocoon
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main
User Documentation

Readers
Overview

Default
Resource Reader

Core

Optional
Database Reader
JSP Reader

Scratchpad
AxisRPC Reader
Byte Range Resource Reader
Directory ZIP Archiver
Image Reader

ByteRangeResourceReader
NAMEresource
WHATThe ByteRangeResourceReader component is used to serve binary data in a sitemap pipeline.
TYPEReader, Sitemap Component
BLOCKScratchpad
CLASSorg.apache.cocoon.reading.ByteRangeResourceReader
SINCECocoon 2.1
CACHEABLEyes
Description

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

Usage

Sitemap pipeline examples

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

<map:match pattern="*.css">
  <map:read type="byterange-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 ByteRangeResourceReader is declared in the sitemap readers section, as shown in the sitemap readers snippet below:

<map:readers default="resource">
...
  <map:reader name="byterange-resource" 
    src="org.apache.cocoon.reading.ByteRangeResourceReader" 
    logger="sitemap.reader.byterang-resource" 
    pool-max="32" pool-min="1" pool-grow="4"/>
    <!-- optional reader configuration -->
    ...
  </map:readers>
...
        
Configuration

The ImageReader has no configuration options.

Setup

The ByteRangeResourceReader accepts following sitemap setup parameters

ParameternameTypeComment
expiresTime 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-testboolean This parameter is optional. This boolean parameter controlls 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.

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

<map:readers default="byterange-resource">
  <map:reader name="byterange-resource" 
    src="org.apache.cocoon.reading.ByteRangeResourceReader" 
    logger="sitemap.reader.resource" 
    pool-max="32" pool-min="1" pool-grow="4"/>
    <!-- optional reader configuration -->
    <map:parameter name="expires" value="86400000"/>
  </map:readers>
...
        
Effect on Object Model and Sitemap Parameters

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

Bugs/Caveats

The ByteRangeResourceReader does support HTTP ranges.

History

12-25-02: Initial document creation by Bernhard Huber

Copyright

Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.

See also

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.