net.groboclown.util.http.v1
Interface IHttpResponseMessage

All Known Implementing Classes:
HttpResponseMessageImpl, SimpleHttpResponseMessage

public interface IHttpResponseMessage

An interface which contains all the information received from the HTTP request message.

Since:
Alpha 0.9.0
Version:
Alpha 0.9.1
Author:
Matt Albrecht

Method Summary
 String getHeader(String name)
          Returns the first value encountered of the header with the given name.
 Enumeration getHeaderNames()
          Returns an enumeration of all the names of the headers received in the message.
 String[] getHeaders(String name)
          Returns all the values encountered of the header with the given name, or null if there were none.
 String getHTTPVersion()
          Returns the server's HTTP version, of the form:
 int getIntHeader(String name)
          Returns the first value encountered of the header with the given name as an integer.
 byte[] getMessage()
          Retrieves the message body in bytes.
 int getMessageSize()
          Retrieves the actual size of the returned message body.
 int getStatusCode()
          Returns the status number associated with the message.
 String getStatusMessage()
          Returns the status message associated with the message's status code.
 String getURI()
          Retrieve the URI which returned this message.
 URL getURL()
          Retrieve the URL which returned this message.
 

Method Detail

getURI

public String getURI()
Retrieve the URI which returned this message.
Returns:
the URI of the request message that generated this response.
See Also:
getURL()

getURL

public URL getURL()
Retrieve the URL which returned this message.
Returns:
the URL of the request message that generated this response.
See Also:
getURI()

getHeaderNames

public Enumeration getHeaderNames()
Returns an enumeration of all the names of the headers received in the message.

Note that header names are case-insensitive.

Returns:
the collection of header names that were in the message.

getHeader

public String getHeader(String name)
Returns the first value encountered of the header with the given name. If there are multiple values associated with the header, only the first one is returned.

Note that header names are case-insensitive.

Returns:
the value of header name that was in the message. If there was no such header name, then null is returned. If there were multiple headers of that name, then only the first is returned.
See Also:
getHeaders( String ), getIntHeader( String )

getHeaders

public String[] getHeaders(String name)
Returns all the values encountered of the header with the given name, or null if there were none.

Note that header names are case-insensitive.

Returns:
the value of header name that was in the message. If there was no such header name, then null is returned. If there were multiple headers of that name, then only the first is returned.
See Also:
getHeader( String ), getIntHeader( String )

getIntHeader

public int getIntHeader(String name)
Returns the first value encountered of the header with the given name as an integer. If there are multiple values associated with the header, only the first one is returned. If the name was not present, or the value was not a valid integer, then -1 is returned.

Note that header names are case-insensitive.

Returns:
-1 if there was an error parsing the number.

getMessageSize

public int getMessageSize()
Retrieves the actual size of the returned message body.

getStatusCode

public int getStatusCode()
Returns the status number associated with the message.
See Also:
getStatusMessage()

getStatusMessage

public String getStatusMessage()
Returns the status message associated with the message's status code.
See Also:
getStatusCode()

getMessage

public byte[] getMessage()
Retrieves the message body in bytes. Even though the messages usually consist of characters, it can return an octet-stream of binary data.

getHTTPVersion

public String getHTTPVersion()
Returns the server's HTTP version, of the form:
      HTTP/a.i
 
where a is the major version, and i is the minor version. Currently, the only valid values are HTTP/1.0 and HTTP/1.1.


Written under the LGPL