Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

HTTPClient
Interface RoResponse  view RoResponse download RoResponse.java

All Known Implementing Classes:
Response

public interface RoResponse

This interface represents read-only interface of an intermediate http response. It is the compile-time type passed to various handlers which might the response info but musn't modify the response.

Version:
0.3-2 18/06/1999

Method Summary
 byte[] getData()
          Reads all the response data into a byte array.
 java.lang.String getHeader(java.lang.String hdr)
          retrieves the field for a given header.
 java.util.Date getHeaderAsDate(java.lang.String hdr)
          retrieves the field for a given header.
 int getHeaderAsInt(java.lang.String hdr)
          retrieves the field for a given header.
 java.io.InputStream getInputStream()
          Gets an input stream from which the returned data can be read.
 java.lang.String getReasonLine()
           
 int getStatusCode()
          give the status code for this request.
 java.lang.String getTrailer(java.lang.String trailer)
          Retrieves the field for a given trailer.
 java.util.Date getTrailerAsDate(java.lang.String trailer)
          Retrieves the field for a given trailer.
 int getTrailerAsInt(java.lang.String trailer)
          Retrieves the field for a given tailer.
 java.lang.String getVersion()
           
 

Method Detail

getStatusCode

public int getStatusCode()
                  throws java.io.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


getReasonLine

public java.lang.String getReasonLine()
                               throws java.io.IOException

getVersion

public java.lang.String getVersion()
                            throws java.io.IOException

getHeader

public java.lang.String getHeader(java.lang.String hdr)
                           throws java.io.IOException
retrieves the field for a given header.


getHeaderAsInt

public int getHeaderAsInt(java.lang.String hdr)
                   throws java.io.IOException,
                          java.lang.NumberFormatException
retrieves the field for a given header. The value is parsed as an int.


getHeaderAsDate

public java.util.Date getHeaderAsDate(java.lang.String hdr)
                               throws java.io.IOException,
                                      java.lang.IllegalArgumentException
retrieves the field for a given header. The value is parsed as a date; if this fails it is parsed as a long representing the number of seconds since 12:00 AM, Jan 1st, 1970. If this also fails an IllegalArgumentException is thrown.


getTrailer

public java.lang.String getTrailer(java.lang.String trailer)
                            throws java.io.IOException
Retrieves the field for a given trailer. Note that this should not be invoked until all the response data has been read. If invoked before, it will force the data to be read via getData().


getTrailerAsInt

public int getTrailerAsInt(java.lang.String trailer)
                    throws java.io.IOException,
                           java.lang.NumberFormatException
Retrieves the field for a given tailer. The value is parsed as an int.


getTrailerAsDate

public java.util.Date getTrailerAsDate(java.lang.String trailer)
                                throws java.io.IOException,
                                       java.lang.IllegalArgumentException
Retrieves the field for a given trailer. The value is parsed as a date; if this fails it is parsed as a long representing the number of seconds since 12:00 AM, Jan 1st, 1970. If this also fails an IllegalArgumentException is thrown.
Note: When sending dates use Util.httpDate().


getData

public byte[] getData()
               throws java.io.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.


getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.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.