org.apache.commons.latka.http
Class RequestImpl

java.lang.Object
  |
  +--org.apache.commons.latka.http.RequestImpl
All Implemented Interfaces:
Request

public class RequestImpl
extends java.lang.Object
implements Request

An implementation of a Latka Request interface based on the Jakarta Commons HttpClient package.

Author:
Doug Sale, Morgan Delagrange

Field Summary
static int HTTP_PORT
          Standard HTTP Port
static int HTTPS_PORT
          Standard HTTPS Port
 
Fields inherited from interface org.apache.commons.latka.http.Request
HTTP_METHOD_GET, HTTP_METHOD_HEAD, HTTP_METHOD_POST
 
Method Summary
 Response execute()
          Execute this HTTP request.
 java.lang.String getLabel()
          Assigns a text label to this request.
 int getRequestTiming()
          The amount of time it took to execute the request in milliseconds, or -1 if the request has not been executed successfully
 Session getSession()
          Retrieve the session associated with this request.
 java.net.URL getURL()
          Gets the URL that Latka will attempt to contact.
 void setCredentials(java.lang.String userName, java.lang.String password)
          Sets the basic authentication credentials for this request, if any.
 void setHeader(java.lang.String headerName, java.lang.String headerValue)
          Set a header in the request
 void setParameter(java.lang.String name, java.lang.String value)
          Associate a parameter with this request.
 void setParameters(java.util.Map parameters)
          Associate a group of parameters with this request.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_PORT

public static final int HTTP_PORT
Standard HTTP Port

HTTPS_PORT

public static final int HTTPS_PORT
Standard HTTPS Port
Method Detail

execute

public Response execute()
                 throws java.io.IOException
Description copied from interface: Request
Execute this HTTP request.
Specified by:
execute in interface Request
Following copied from interface: org.apache.commons.latka.http.Request
Returns:
a Response object represnting the HTTP response to the request
Throws:
java.io.IOException - if the remote server could not be reached

getLabel

public java.lang.String getLabel()
Description copied from interface: Request
Assigns a text label to this request. This label will be made available to a LatkaEventListener during a test's execution
Specified by:
getLabel in interface Request
Following copied from interface: org.apache.commons.latka.http.Request
Returns:
the label associated with this request

getRequestTiming

public int getRequestTiming()
Description copied from interface: Request
The amount of time it took to execute the request in milliseconds, or -1 if the request has not been executed successfully
Specified by:
getRequestTiming in interface Request
Returns:
the amount of time it took to execute this request (in milliseconds), or -1 if the request has not yet been executed

getSession

public Session getSession()
Retrieve the session associated with this request.
Specified by:
getSession in interface Request
Returns:
a Session object

getURL

public java.net.URL getURL()
Description copied from interface: Request
Gets the URL that Latka will attempt to contact. Note: since Latka will respect most redirects, this may not be the URL that returns the actual response.
Specified by:
getURL in interface Request
Following copied from interface: org.apache.commons.latka.http.Request
Returns:
the URL associated with this HTTP request

setCredentials

public void setCredentials(java.lang.String userName,
                           java.lang.String password)
Description copied from interface: Request
Sets the basic authentication credentials for this request, if any.
Specified by:
setCredentials in interface Request
Following copied from interface: org.apache.commons.latka.http.Request
Parameters:
userName - user name
password - user's password

setHeader

public void setHeader(java.lang.String headerName,
                      java.lang.String headerValue)
Set a header in the request
Specified by:
setHeader in interface Request
Parameters:
headerName - name of any HTTP request header
headerValue - value of that header

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Associate a parameter with this request.
Specified by:
setParameter in interface Request
Parameters:
name - the lvalue of the parameter
name - the rvalue of the parameter
Throws:
java.lang.IllegalArgumentException - if a parameter is null

setParameters

public void setParameters(java.util.Map parameters)
Associate a group of parameters with this request.
Specified by:
setParameters in interface Request
Parameters:
parameters - a map of parameters (lvalues -> rvalues)
Throws:
java.lang.IllegalArgumentException - if a parameter is null or not a String


Copyright © 2001 Apache Software Foundation. Documenation generated September 13 2001.