org.apache.commons.latka.http
Interface Request

All Known Implementing Classes:
RequestImpl

public interface Request

A Latka Request represents a request from an HTTP server.

Author:
Doug Sale, Morgan Delagrange

Field Summary
static int HTTP_METHOD_GET
          An integer representing the HTTP GET method
static int HTTP_METHOD_HEAD
          An integer representing the HTTP POST method
static int HTTP_METHOD_POST
          An integer representing the HTTP POST method
 
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)
          Sets a request header.
 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.
 

Field Detail

HTTP_METHOD_GET

public static final int HTTP_METHOD_GET
An integer representing the HTTP GET method

HTTP_METHOD_HEAD

public static final int HTTP_METHOD_HEAD
An integer representing the HTTP POST method

HTTP_METHOD_POST

public static final int HTTP_METHOD_POST
An integer representing the HTTP POST method
Method Detail

execute

public Response execute()
                 throws java.io.IOException
Execute this 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()
Assigns a text label to this request. This label will be made available to a LatkaEventListener during a test's execution
Returns:
the label associated with this request

getRequestTiming

public int getRequestTiming()
The amount of time it took to execute the request in milliseconds, or -1 if the request has not been executed successfully
Returns:
time it took to execute the request in millis

getSession

public Session getSession()
Retrieve the session associated with this request.
Returns:
a Session object

getURL

public java.net.URL getURL()
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.
Returns:
the URL associated with this HTTP request

setCredentials

public void setCredentials(java.lang.String userName,
                           java.lang.String password)
Sets the basic authentication credentials for this request, if any.
Parameters:
userName - user name
password - user's password

setHeader

public void setHeader(java.lang.String headerName,
                      java.lang.String headerValue)
Sets a request header.
Parameters:
headerName - header name
headerValue - header value or null for a null header

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)
Associate a parameter with this request.
Parameters:
name - the name of the parameter
name - the value of the parameter
Throws:
java.lang.IllegalArgumentException - if a parameter is null or not a String

setParameters

public void setParameters(java.util.Map parameters)
Associate a group of parameters with this 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.