|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.excalibur.source.impl.HTTPClientSource
HTTP URL Source object, based on the Jakarta Commons HttpClient project.
Field Summary | |
static String |
CONTENT_LENGTH
Constant used when obtaining the Content-Length from HTTP Headers |
static String |
CONTENT_TYPE
Constant used when obtaining the Content-Type from HTTP Headers |
static String |
GET
Constant used for identifying GET requests. |
static String |
LAST_MODIFIED
Constant used when obtaining the Last-Modified date from HTTP Headers |
static String |
POST
Constant used for identifying POST requests. |
static String |
PROXY_HOST
Constant used for configuring the proxy hostname. |
static String |
PROXY_PORT
Constant used for configuring the proxy port number. |
Constructor Summary | |
HTTPClientSource(String uri,
Map parameters,
org.apache.commons.httpclient.HttpState httpState)
Constructor, creates a new HTTPClientSource instance. |
Method Summary | |
boolean |
canCancel(OutputStream stream)
Method to determine whether writing to the supplied OutputStream (which must be that returned from getOutputStream() ) can
be cancelled |
void |
cancel(OutputStream stream)
Cancels any data sent to the OutputStream returned by
getOutputStream() . |
void |
delete()
Deletes the referenced resource. |
protected int |
executeMethod(org.apache.commons.httpclient.HttpMethod method)
Executes a particular HttpMethod and updates internal
data storage. |
boolean |
exists()
Method to ascertain whether the given resource actually exists. |
long |
getContentLength()
Obtain the content length of the referenced resource. |
InputStream |
getInputStream()
Method to obtain an InputStream to read the response
from the server. |
long |
getLastModified()
Get the last modification date of this source. |
String |
getMimeType()
Obtain the mime-type for the referenced resource. |
OutputStream |
getOutputStream()
Obtain an OutputStream to write to. |
String |
getScheme()
Return the URI scheme identifier, ie. |
String |
getURI()
Obtain the absolute URI this Source object references. |
SourceValidity |
getValidity()
Obtain a SourceValidity object. |
void |
initialize()
Initializes this HTTPClientSource instance. |
void |
parameterize(org.apache.avalon.framework.parameters.Parameters params)
Parameterizes this HTTPClientSource instance. |
void |
refresh()
Refreshes this Source object. |
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 |
Field Detail |
public static final String POST
public static final String GET
public static final String PROXY_HOST
public static final String PROXY_PORT
public static final String CONTENT_TYPE
public static final String CONTENT_LENGTH
public static final String LAST_MODIFIED
Constructor Detail |
public HTTPClientSource(String uri, Map parameters, org.apache.commons.httpclient.HttpState httpState) throws Exception
HTTPClientSource
instance.
uri
- URIparameters
- contextual parameters passed to this instance
Exception
- if an error occursMethod Detail |
public void parameterize(org.apache.avalon.framework.parameters.Parameters params) throws org.apache.avalon.framework.parameters.ParameterException
HTTPClientSource
instance.
parameterize
in interface org.apache.avalon.framework.parameters.Parameterizable
params
- a Parameters
instance.
org.apache.avalon.framework.parameters.ParameterException
- if an error occurspublic void initialize() throws Exception
HTTPClientSource
instance.
initialize
in interface org.apache.avalon.framework.activity.Initializable
Exception
- if an error occursprotected int executeMethod(org.apache.commons.httpclient.HttpMethod method) throws IOException
HttpMethod
and updates internal
data storage.
method
- HttpMethod
to execute
IOException
- if an error occurspublic boolean exists()
exists
in interface Source
true
if the resource pointed to by the
URI during construction exists, false
otherwise.public InputStream getInputStream() throws IOException, SourceNotFoundException
InputStream
to read the response
from the server.
getInputStream
in interface Source
InputStream
containing data sent from the server.
IOException
- if some I/O problem occurs.
SourceNotFoundException
- if the source doesn't exist.public String getURI()
Source
object references.
getURI
in interface Source
String
object references.public String getScheme()
getScheme
in interface Source
public SourceValidity getValidity()
SourceValidity
object.
getValidity
in interface Source
SourceValidity
object, or
null
if this is not possible.public void refresh()
Source
object.
refresh
in interface Source
public String getMimeType()
getMimeType
in interface Source
public long getContentLength()
getContentLength
in interface Source
public long getLastModified()
getLastModified
in interface Source
0
if unknown.public OutputStream getOutputStream() throws IOException
OutputStream
to write to. The OutputStream
returned actually references a temporary local file, which will
be written to the server upon closing.
The returned stream must be closed or cancelled by the calling code.
getOutputStream
in interface ModifiableSource
OutputStream
instance
IOException
- if an error occurspublic void delete() throws SourceException
delete
in interface ModifiableSource
SourceException
- if an error occurspublic boolean canCancel(OutputStream stream)
getOutputStream()
) can
be cancelled
canCancel
in interface ModifiableSource
public void cancel(OutputStream stream) throws IOException
OutputStream
returned by
getOutputStream()
.
After calling this method, the supplied OutputStream
should no longer be used.
cancel
in interface ModifiableSource
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |