|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLoggable | +--org.apache.cocoon.components.source.AbstractStreamSource
This abstract class provides convenience methods to implement a stream based Source. Implement getInputStream(), getSystemId() and optionally override refresh(), recycle(), getLastModified() and getContentLength() to obtain a valid Source implementation.
This base implementation provides services to parse HTML sources
(HTML is not valid XML) using JTidy, if present. The source is
considered to contain HTML if isHTMLContent()
returns
true.
Field Summary | |
protected org.apache.avalon.framework.component.ComponentManager |
manager
The ComponentManager needed for streaming |
static javax.xml.transform.TransformerFactory |
transformerFactory
The TrAX factory for serializing xml |
Constructor Summary | |
protected |
AbstractStreamSource(org.apache.avalon.framework.component.ComponentManager manager)
Construct a new object |
Method Summary | |
boolean |
exists()
Returns true if getInputStream() succeeds.
|
long |
getContentLength()
Override this method to set the Content Length |
org.xml.sax.InputSource |
getInputSource()
Return a new InputSource object |
long |
getLastModified()
Override this method to set the Last Modification date |
protected boolean |
isHTMLContent()
Does this source contain HTML ? |
void |
recycle()
To be overriden in concrete subclasses if needed. |
void |
refresh()
To be overriden in concrete subclasses if needed. |
void |
toSAX(org.xml.sax.ContentHandler handler)
Stream content to a content handler or to an XMLConsumer. |
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 |
Methods inherited from interface org.apache.cocoon.environment.Source |
getInputStream, getSystemId |
Field Detail |
public static javax.xml.transform.TransformerFactory transformerFactory
protected org.apache.avalon.framework.component.ComponentManager manager
Constructor Detail |
protected AbstractStreamSource(org.apache.avalon.framework.component.ComponentManager manager)
Method Detail |
protected boolean isHTMLContent()
The default here is to return false. Concrete subclasses should override this if needed.
public org.xml.sax.InputSource getInputSource() throws java.io.IOException, ProcessingException
InputSource
objectgetInputSource
in interface Source
org.apache.cocoon.environment.Source
InputSource
valueProcessingException
- if an error occursjava.io.IOException
- if an error occurspublic void toSAX(org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException, ProcessingException
toSAX
in interface XMLizable
ResourceNotFoundException
- if file not found or
HTTP location does not exist.org.xml.sax.SAXException
- if failed to parse source document.public long getContentLength()
getContentLength
in interface Source
public long getLastModified()
getLastModified
in interface Source
public boolean exists()
true
if getInputStream()
succeeds.
Subclasses can provide a more efficient implementation.public void recycle()
recycle
in interface org.apache.avalon.excalibur.pool.Recyclable
public void refresh()
refresh
in interface ModifiableSource
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |