org.apache.cocoon.reading
Class ResourceReader

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.reading.AbstractReader
              |
              +--org.apache.cocoon.reading.ResourceReader
All Implemented Interfaces:
Cacheable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.excalibur.pool.Poolable, Reader, org.apache.avalon.excalibur.pool.Recyclable, SitemapModelComponent, SitemapOutputComponent

public class ResourceReader
extends AbstractReader
implements Cacheable

The ResourceReader component is used to serve binary data in a sitemap pipeline. It makes use of HTTP Headers to determine if the requested resource should be written to the OutputStream or if it can signal that it hasn't changed. Parameters:

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

Version:
CVS $Id: ResourceReader.java,v 1.7.2.2 2002/06/05 01:36:11 vgritsenko Exp $
Author:
Giacomo Pati

Fields inherited from class org.apache.cocoon.reading.AbstractReader
objectModel, out, parameters, resolver, source
 
Fields inherited from interface org.apache.cocoon.reading.Reader
ROLE
 
Constructor Summary
ResourceReader()
           
 
Method Summary
 void generate()
          Generates the requested resource.
 long generateKey()
          Generate the unique key.
 CacheValidity generateValidity()
          Generate the validity object.
 long getLastModified()
           
 java.lang.String getMimeType()
          Returns the mime-type of the resource in process.
 void recycle()
          Recycle the component
 void setup(SourceResolver resolver, java.util.Map objectModel, java.lang.String src, org.apache.avalon.framework.parameters.Parameters par)
          Setup the reader.
 
Methods inherited from class org.apache.cocoon.reading.AbstractReader
setOutputStream, shouldSetContentLength
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceReader

public ResourceReader()
Method Detail

setup

public void setup(SourceResolver resolver,
                  java.util.Map objectModel,
                  java.lang.String src,
                  org.apache.avalon.framework.parameters.Parameters par)
           throws ProcessingException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Setup the reader. The resource is opened to get an InputStream, the length and the last modification date
Overrides:
setup in class AbstractReader

recycle

public void recycle()
Description copied from class: AbstractReader
Recycle the component
Overrides:
recycle in class AbstractReader

generateKey

public long generateKey()
Generate the unique key. This key must be unique inside the space of this component.
Specified by:
generateKey in interface Cacheable
Returns:
The generated key hashes the src

generateValidity

public CacheValidity generateValidity()
Generate the validity object.
Specified by:
generateValidity in interface Cacheable
Returns:
The generated validity object or null if the component is currently not cacheable.

getLastModified

public long getLastModified()
Overrides:
getLastModified in class AbstractReader
Returns:
the time the read source was last modified or 0 if it is not possible to detect

generate

public void generate()
              throws java.io.IOException,
                     ProcessingException
Generates the requested resource.

getMimeType

public java.lang.String getMimeType()
Returns the mime-type of the resource in process.
Overrides:
getMimeType in class AbstractReader


Copyright � 1999-2002 Apache Software Foundation. All Rights Reserved.