Class HTTPClient.HTTPResponse
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class HTTPClient.HTTPResponse
java.lang.Object
   |
   +----HTTPClient.HTTPResponse
  -  public class HTTPResponse
  -  extends Object
This defines the http-response class returned by the requests.
  -  Version:
  
-  0.2 (bug fix 2)  23/03/1997
  
-  Author:
  
-  Ronald Tschalär
   
  -   getData() getData()
-  Reads all the response data into a byte array.
  
-   getEffectiveURL() getEffectiveURL()
-  get the final URL of the document.
  
-   getHeader(String) getHeader(String)
-  retrieves the field for a given header.
  
-   getHeaderAsDate(String) getHeaderAsDate(String)
-  retrieves the field for a given header.
  
-   getHeaderAsInt(String) getHeaderAsInt(String)
-  retrieves the field for a given header.
  
-   getInputStream() getInputStream()
-  Gets an input stream from which the returned data can be read.
  
-   getReasonLine() getReasonLine()
-  give the reason line associated with the status code.
  
-   getServer() getServer()
-  get the name and type of server.
  
-   getStatusCode() getStatusCode()
-  give the status code for this request.
  
-   getVersion() getVersion()
-  get the HTTP version used for the response.
  
-   listHeaders() listHeaders()
-  returns an enumeration of all the headers available via getHeader().
  
-   toString() toString()
-  produces a full list of headers and their values, one per line.
   
 getStatusCode
getStatusCode
  public final int getStatusCode() throws IOException
  -  give the status code for this request. These are grouped as follows:
  -  1xx - Informational (new in HTTP/1.1)
  
-  2xx - Success
  
-  3xx - Redirection
  
-  4xx - Client Error
  
-  5xx - Server Error
 
    -  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 getReasonLine
getReasonLine
  public final String getReasonLine() throws IOException
  -  give the reason line associated with the status code.
  
    -  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 getVersion
getVersion
  public final String getVersion() throws IOException
  -  get the HTTP version used for the response.
  
    -  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 getServer
getServer
  public final String getServer() throws IOException
  -  get the name and type of server.
  
    -  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 getEffectiveURL
getEffectiveURL
  public final URL getEffectiveURL() throws IOException
  -  get the final URL of the document. This is set if the original
request was deferred via the "moved" (301, 302, or 303) return
status.
  
    -  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 getHeader
getHeader
  public String getHeader(String hdr) throws IOException
  -  retrieves the field for a given header.
  
    -  Parameters:
    
-  hdr - the header name.
    
-  Returns:
    
-  the value for the header, or null if non-existent.
    
-  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 getHeaderAsInt
getHeaderAsInt
  public int getHeaderAsInt(String hdr) throws IOException
  -  retrieves the field for a given header. The value is parsed as an
int.
  
    -  Parameters:
    
-  hdr - the header name.
    
-  Returns:
    
-  the value for the header, or -1 if non-existent.
    
-  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 getHeaderAsDate
getHeaderAsDate
  public Date getHeaderAsDate(String hdr) throws IOException
  -  retrieves the field for a given header. The value is parsed as a
date.
 Note: When sending dates use .toGMTString() .
    -  Parameters:
    
-  hdr - the header name.
    
-  Returns:
    
-  the value for the header, or null if non-existent.
    
-  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 listHeaders
listHeaders
  public Enumeration listHeaders() throws IOException
  -  returns an enumeration of all the headers available via getHeader().
  
    -  Throws: IOException
    
-  If any exception occurs on the socket.
  
 
 getData
getData
  public synchronized byte[] getData() throws IOException
  -  Reads all the response data into a byte array. Note that this method
won't return until all the data has been received (so for
instance don't invoke this method if the server is doing a server
push). If getInputStream() had been previously called then this method
only returns any unread data remaining on the stream and then closes
it.
  
    -  Returns:
    
-  an array containing the data (body) returned. If no data
        was returned then it's set to a zero-length array.
    
-  Throws: IOException
    
-  If any io exception occured while reading
			      the data
    
-  See Also:
    
-  getInputStream
  
 
 getInputStream
getInputStream
  public synchronized InputStream getInputStream() throws IOException
  -  Gets an input stream from which the returned data can be read. Note
that if getData() had been previously called it will actually return
a ByteArrayInputStream created from that data.
  
    -  Returns:
    
-  the InputStream.
    
-  Throws: IOException
    
-  If any exception occurs on the socket.
    
-  See Also:
    
-  getData
  
 
 toString
toString
  public String toString()
  -  produces a full list of headers and their values, one per line.
  
    -  Returns:
    
-  a string containing the headers
    
-  Throws: IOException
    
-  if an exception occurs while reading the headers.
    
-  Overrides:
    
-  toString in class Object
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index