org.apache.xerces.util

Class HTTPInputSource


public final class HTTPInputSource
extends org.apache.xerces.xni.parser.XMLInputSource

This class represents an input source for an XML resource retrievable over HTTP. In addition to the properties provided by an XMLInputSource an HTTP input source also has HTTP request properties and a preference whether HTTP redirects will be followed. Note that these properties will only be used if reading this input source will induce an HTTP connection.
Version:
$Id: HTTPInputSource.java,v 1.2 2005/05/15 20:01:26 mrglavas Exp $
Author:
Michael Glavassevich, IBM

Field Summary

protected boolean
fFollowRedirects
Preference for whether HTTP redirects should be followed.
protected Map
fHTTPRequestProperties
HTTP request properties.

Fields inherited from class org.apache.xerces.xni.parser.XMLInputSource

fBaseSystemId, fByteStream, fCharStream, fEncoding, fPublicId, fSystemId

Constructor Summary

HTTPInputSource(String publicId, String systemId, String baseSystemId)
Constructs an input source from just the public and system identifiers, leaving resolution of the entity and opening of the input stream up to the caller.
HTTPInputSource(String publicId, String systemId, String baseSystemId, InputStream byteStream, String encoding)
Constructs an input source from a byte stream.
HTTPInputSource(String publicId, String systemId, String baseSystemId, Reader charStream, String encoding)
Constructs an input source from a character stream.
HTTPInputSource(org.apache.xerces.xni.XMLResourceIdentifier resourceIdentifier)
Constructs an input source from a XMLResourceIdentifier object, leaving resolution of the entity and opening of the input stream up to the caller.

Method Summary

boolean
getFollowHTTPRedirects()
Returns the preference whether HTTP redirects should be followed.
Iterator
getHTTPRequestProperties()
Returns an iterator for the request properties this input source contains.
String
getHTTPRequestProperty(String key)
Returns the value of the request property associated with the given property name.
void
setFollowHTTPRedirects(boolean followRedirects)
Sets the preference whether HTTP redirects should be followed.
void
setHTTPRequestProperty(String key, String value)
Sets the value of the request property associated with the given property name.

Methods inherited from class org.apache.xerces.xni.parser.XMLInputSource

getBaseSystemId, getByteStream, getCharacterStream, getEncoding, getPublicId, getSystemId, setBaseSystemId, setByteStream, setCharacterStream, setEncoding, setPublicId, setSystemId

Field Details

fFollowRedirects

protected boolean fFollowRedirects
Preference for whether HTTP redirects should be followed. *

fHTTPRequestProperties

protected Map fHTTPRequestProperties
HTTP request properties. *

Constructor Details

HTTPInputSource

public HTTPInputSource(String publicId,
                       String systemId,
                       String baseSystemId)
Constructs an input source from just the public and system identifiers, leaving resolution of the entity and opening of the input stream up to the caller.
Parameters:
publicId - The public identifier, if known.
systemId - The system identifier. This value should always be set, if possible, and can be relative or absolute. If the system identifier is relative, then the base system identifier should be set.
baseSystemId - The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.

HTTPInputSource

public HTTPInputSource(String publicId,
                       String systemId,
                       String baseSystemId,
                       InputStream byteStream,
                       String encoding)
Constructs an input source from a byte stream.
Parameters:
publicId - The public identifier, if known.
systemId - The system identifier. This value should always be set, if possible, and can be relative or absolute. If the system identifier is relative, then the base system identifier should be set.
baseSystemId - The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.
byteStream - The byte stream.
encoding - The encoding of the byte stream, if known.

HTTPInputSource

public HTTPInputSource(String publicId,
                       String systemId,
                       String baseSystemId,
                       Reader charStream,
                       String encoding)
Constructs an input source from a character stream.
Parameters:
publicId - The public identifier, if known.
systemId - The system identifier. This value should always be set, if possible, and can be relative or absolute. If the system identifier is relative, then the base system identifier should be set.
baseSystemId - The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.
charStream - The character stream.
encoding - The original encoding of the byte stream used by the reader, if known.

HTTPInputSource

public HTTPInputSource(org.apache.xerces.xni.XMLResourceIdentifier resourceIdentifier)
Constructs an input source from a XMLResourceIdentifier object, leaving resolution of the entity and opening of the input stream up to the caller.
Parameters:
resourceIdentifier - the XMLResourceIdentifier containing the information

Method Details

getFollowHTTPRedirects

public boolean getFollowHTTPRedirects()
Returns the preference whether HTTP redirects should be followed. By default HTTP redirects will be followed.

getHTTPRequestProperties

public Iterator getHTTPRequestProperties()
Returns an iterator for the request properties this input source contains. Each object returned by the iterator is an instance of java.util.Map.Entry where each key and value are a pair of strings corresponding to the name and value of a request property.
Returns:
an iterator for the request properties this input source contains

getHTTPRequestProperty

public String getHTTPRequestProperty(String key)
Returns the value of the request property associated with the given property name.
Parameters:
key - the name of the request property
Returns:
the value of the request property or null if this property has not been set

setFollowHTTPRedirects

public void setFollowHTTPRedirects(boolean followRedirects)
Sets the preference whether HTTP redirects should be followed. By default HTTP redirects will be followed.

setHTTPRequestProperty

public void setHTTPRequestProperty(String key,
                                   String value)
Sets the value of the request property associated with the given property name.
Parameters:
key - the name of the request property
value - the value of the request property

Copyright B) 1999-2005 Apache XML Project. All Rights Reserved.