org.apache.commons.latka.http
Class ResponseImpl

java.lang.Object
  extended by org.apache.commons.latka.http.ResponseImpl
All Implemented Interfaces:
Response

public class ResponseImpl
extends Object
implements Response

An implementation of a Latka Response interface based on the Apache Commons HttpClient package.

Version:
$Id: ResponseImpl.java 561366 2007-07-31 15:58:29Z rahul $
Author:
Doug Sale, Morgan Delagrange, dIon Gillard

Field Summary
protected  org.apache.commons.httpclient.HttpMethod _httpMethod
          the implementation of the http method used to create the response
protected  RequestImpl _request
          the request used to get the response
 
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()
          Defined in interface
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_request

protected RequestImpl _request
the request used to get the response


_httpMethod

protected org.apache.commons.httpclient.HttpMethod _httpMethod
the implementation of the http method used to create the response

Method Detail

getRequest

public Request getRequest()
Defined in interface

Specified by:
getRequest in interface Response
Returns:
the request associated with this response
See Also:
Response.getRequest()

getStatusCode

public int getStatusCode()
Specified by:
getStatusCode in interface Response
Returns:
the integer status code provided by the HTTP server.

getStatusText

public String getStatusText()
Specified by:
getStatusText in interface Response
Returns:
the status text (or "reason phrase") associated with the response

getResource

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

Specified by:
getResource in interface Response
Returns:
the contents of the HTTP response body has a String, or null if there was no response body

getHeader

public 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.

Specified by:
getHeader in interface Response
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

getByteLength

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

Specified by:
getByteLength in interface Response
Returns:
Byte length of the response stream

getStream

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

Specified by:
getStream in interface Response
Returns:
InputStream containing the HTTP response, or null if the response contains no body


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