FileDocCategorySizeDatePackage
HTTPInputSource.javaAPI DocApache Xerces 3.0.17874Fri Sep 14 20:33:52 BST 2007org.apache.xerces.util

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.
author
Michael Glavassevich, IBM
version
$Id: HTTPInputSource.java 447241 2006-09-18 05:12:57Z mrglavas $

Fields Summary
protected boolean
fFollowRedirects
Preference for whether HTTP redirects should be followed.
protected Map
fHTTPRequestProperties
HTTP request properties.
Constructors Summary
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.

param
publicId The public identifier, if known.
param
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.
param
baseSystemId The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.

    
    //
    // Constructors
    //
    
                                                                                                                                                                                                                                    
           
        super(publicId, systemId, baseSystemId);
    
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.

param
resourceIdentifier the XMLResourceIdentifier containing the information

        super(resourceIdentifier);
    
public HTTPInputSource(String publicId, String systemId, String baseSystemId, InputStream byteStream, String encoding)
Constructs an input source from a byte stream.

param
publicId The public identifier, if known.
param
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.
param
baseSystemId The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.
param
byteStream The byte stream.
param
encoding The encoding of the byte stream, if known.

        super(publicId, systemId, baseSystemId, byteStream, encoding);
    
public HTTPInputSource(String publicId, String systemId, String baseSystemId, Reader charStream, String encoding)
Constructs an input source from a character stream.

param
publicId The public identifier, if known.
param
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.
param
baseSystemId The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.
param
charStream The character stream.
param
encoding The original encoding of the byte stream used by the reader, if known.

        super(publicId, systemId, baseSystemId, charStream, encoding);
    
Methods Summary
public booleangetFollowHTTPRedirects()
Returns the preference whether HTTP redirects should be followed. By default HTTP redirects will be followed.

        return fFollowRedirects;
    
public java.util.IteratorgetHTTPRequestProperties()
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.

return
an iterator for the request properties this input source contains

        return fHTTPRequestProperties.entrySet().iterator();
    
public java.lang.StringgetHTTPRequestProperty(java.lang.String key)
Returns the value of the request property associated with the given property name.

param
key the name of the request property
return
the value of the request property or null if this property has not been set

        return (String) fHTTPRequestProperties.get(key);
    
public voidsetFollowHTTPRedirects(boolean followRedirects)
Sets the preference whether HTTP redirects should be followed. By default HTTP redirects will be followed.

        fFollowRedirects = followRedirects;
    
public voidsetHTTPRequestProperty(java.lang.String key, java.lang.String value)
Sets the value of the request property associated with the given property name.

param
key the name of the request property
param
value the value of the request property

        if (value != null) {
            fHTTPRequestProperties.put(key, value);
        }
        else {
            fHTTPRequestProperties.remove(key);
        }