org.apache.cocoon.reading
Class AbstractReader

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.reading.AbstractReader
All Implemented Interfaces:
Poolable, Recyclable, Component, LogEnabled, Reader, SitemapModelComponent, SitemapOutputComponent
Direct Known Subclasses:
CaptchaReader, ComposerReader, ResourceReader, ServiceableReader

public abstract class AbstractReader
extends AbstractLogEnabled
implements Reader, Recyclable

A reader can be used to generate binary output for a request. This abstract class helps in implementing a custom reader.

Version:
CVS $Id: AbstractReader.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Giacomo Pati

Field Summary
protected  Map objectModel
          The current Map of the object model.
protected  OutputStream out
          The OutputStream to write on.
protected  Parameters parameters
          The current Parameters.
protected  SourceResolver resolver
          The current SourceResolver.
protected  String source
          The source URI associated with the request or null.
 
Fields inherited from interface org.apache.cocoon.reading.Reader
ROLE
 
Constructor Summary
AbstractReader()
           
 
Method Summary
 long getLastModified()
           
 String getMimeType()
          Get the mime-type of the output of this Reader
 void recycle()
          Recycle the component
 void setOutputStream(OutputStream out)
          Set the OutputStream
 void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
          Set the SourceResolver the object model Map, the source and sitemap Parameters used to process the request.
 boolean shouldSetContentLength()
          Test if the component wants to set the content length
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.reading.Reader
generate
 

Field Detail

resolver

protected SourceResolver resolver
The current SourceResolver.


objectModel

protected Map objectModel
The current Map of the object model.


parameters

protected Parameters parameters
The current Parameters.


source

protected String source
The source URI associated with the request or null.


out

protected OutputStream out
The OutputStream to write on.

Constructor Detail

AbstractReader

public AbstractReader()
Method Detail

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws ProcessingException,
                  SAXException,
                  IOException
Set the SourceResolver the object model Map, the source and sitemap Parameters used to process the request.

Specified by:
setup in interface SitemapModelComponent
Throws:
ProcessingException
SAXException
IOException

setOutputStream

public void setOutputStream(OutputStream out)
Set the OutputStream

Specified by:
setOutputStream in interface SitemapOutputComponent

getMimeType

public String getMimeType()
Get the mime-type of the output of this Reader

Specified by:
getMimeType in interface SitemapOutputComponent
See Also:
AbstractProcessingPipeline.setMimeTypeForSerializer(org.apache.cocoon.environment.Environment), AbstractProcessingPipeline.setMimeTypeForReader(org.apache.cocoon.environment.Environment)

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface Reader
Returns:
the time the read source was last modified or 0 if it is not possible to detect

recycle

public void recycle()
Recycle the component

Specified by:
recycle in interface Recyclable

shouldSetContentLength

public boolean shouldSetContentLength()
Test if the component wants to set the content length

Specified by:
shouldSetContentLength in interface SitemapOutputComponent


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