org.apache.commons.latka.http
Interface Response

All Known Implementing Classes:
ResponseImpl

public interface Response

A Latka Response represents a response from an HTTP server.

Author:
Doug Sale, Morgan Delagrange

Method Summary
 int getByteLength()
          Returns the length of the Response stream (as bytes), or -1 if no stream is available
 String getHeader(String headerName)
          Check a response header.
 Request getRequest()
          Getter for request property
 String getResource()
          Returns the resource, in string form, provided by the HTTP server
 int getStatusCode()
           
 String getStatusText()
           
 InputStream getStream()
          Get the actual bytes returned by the web server
 

Method Detail

getStatusCode

int getStatusCode()
Returns:
the integer status code provided by the HTTP server.

getStatusText

String getStatusText()
Returns:
the status text (or "reason phrase") associated with the response.

getResource

String getResource()
Returns the resource, in string form, provided by the HTTP server

Returns:
the contents of the HTTP response body has a String, or null if there was no response body

getStream

InputStream getStream()
Get the actual bytes returned by the web server

Returns:
InputStream containing the HTTP response, or null if the response contains no body

getByteLength

int getByteLength()
Returns the length of the Response stream (as bytes), or -1 if no stream is available

Returns:
Byte length of the response stream

getRequest

Request getRequest()
Getter for request property

Returns:
the request that generated this response

getHeader

String getHeader(String headerName)
Check a response header. If more than one header of the same name is encountered, they are collapsed into one comma-separated String.

Parameters:
headerName - The name of the header to find in the Reponse
Returns:
the value of the header(s), or null if the header does not exist


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.