org.apache.cocoon.reading
Class AbstractReader

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.reading.AbstractReader
All Implemented Interfaces:
Poolable, org.apache.cocoon.reading.Reader, Recyclable, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.sitemap.SitemapOutputComponent
Direct Known Subclasses:
ServiceableReader

public abstract class AbstractReader
extends org.apache.cocoon.util.AbstractLogEnabled
implements org.apache.cocoon.reading.Reader, Recyclable

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

Version:
$Id: AbstractReader.html 1304280 2012-03-23 11:18:01Z ilgrosso $

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  org.apache.cocoon.environment.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(org.apache.cocoon.environment.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.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
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 org.apache.cocoon.environment.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(org.apache.cocoon.environment.SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws org.apache.cocoon.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 org.apache.cocoon.sitemap.SitemapModelComponent
Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException

setOutputStream

public void setOutputStream(OutputStream out)
Set the OutputStream

Specified by:
setOutputStream in interface org.apache.cocoon.sitemap.SitemapOutputComponent

getMimeType

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

Specified by:
getMimeType in interface org.apache.cocoon.sitemap.SitemapOutputComponent

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface org.apache.cocoon.reading.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 org.apache.cocoon.sitemap.SitemapOutputComponent


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.