org.apache.cocoon.components.source
Class URLSource

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.components.source.AbstractStreamSource
              |
              +--org.apache.cocoon.components.source.URLSource
All Implemented Interfaces:
org.apache.avalon.framework.logger.Loggable, ModifiableSource, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, Source, XMLizable

public class URLSource
extends AbstractStreamSource

Description of a source which is described by an URL.

Version:
CVS $Id: URLSource.java,v 1.13.2.3 2002/08/02 00:25:10 vgritsenko Exp $
Author:
Carsten Ziegeler

Fields inherited from class org.apache.cocoon.components.source.AbstractStreamSource
manager, transformerFactory
 
Constructor Summary
URLSource(java.net.URL url, org.apache.avalon.framework.component.ComponentManager manager)
          Construct a new object
 
Method Summary
 long getContentLength()
          Get the content length of the source or -1 if it is not possible to determine the length.
 java.io.InputStream getInputStream()
          Return an InputStream object to read from the source.
 long getLastModified()
          Get the last modification date of the source or 0 if it is not possible to determine the date.
 java.lang.String getSystemId()
          Return the unique identifer for this source
protected  boolean isHTMLContent()
          Does this source contain HTML ?
 void recycle()
          To be overriden in concrete subclasses if needed.
 void refresh()
          Refresh this object and update the last modified date and content length.
 void setPostParameters(org.apache.excalibur.source.SourceParameters pars)
          Set the post parameters
 
Methods inherited from class org.apache.cocoon.components.source.AbstractStreamSource
exists, getInputSource, toSAX
 
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

URLSource

public URLSource(java.net.URL url,
                 org.apache.avalon.framework.component.ComponentManager manager)
          throws java.io.IOException
Construct a new object
Method Detail

isHTMLContent

protected boolean isHTMLContent()
Description copied from class: AbstractStreamSource
Does this source contain HTML ? If true, JTidy will be used (if available) to parse the input as XML.

The default here is to return false. Concrete subclasses should override this if needed.

Overrides:
isHTMLContent in class AbstractStreamSource

getLastModified

public long getLastModified()
Get the last modification date of the source or 0 if it is not possible to determine the date.
Overrides:
getLastModified in class AbstractStreamSource

getContentLength

public long getContentLength()
Get the content length of the source or -1 if it is not possible to determine the length.
Overrides:
getContentLength in class AbstractStreamSource

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException,
                                          ProcessingException
Return an InputStream object to read from the source.
Throws:
ResourceNotFoundException - if file not found or HTTP location does not exist.
java.io.IOException - if I/O error occured.

getSystemId

public java.lang.String getSystemId()
Return the unique identifer for this source

refresh

public void refresh()
Refresh this object and update the last modified date and content length.
Overrides:
refresh in class AbstractStreamSource

recycle

public void recycle()
Description copied from class: AbstractStreamSource
To be overriden in concrete subclasses if needed.
Overrides:
recycle in class AbstractStreamSource

setPostParameters

public void setPostParameters(org.apache.excalibur.source.SourceParameters pars)
Set the post parameters


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