com.meterware.httpunit
Class WebConversation

java.lang.Object
  |
  +--com.meterware.httpunit.WebConversation

public class WebConversation
extends java.lang.Object

The context for a series of HTTP requests. This class manages cookies used to maintain session context, computes relative URLs, and generally emulates the browser behavior needed to build an automated test of a web site.

Author:
Russell Gold, Jan Ohrstrom

Constructor Summary
WebConversation()
          Creates a new web conversation.
 
Method Summary
 void addCookie(java.lang.String name, java.lang.String value)
          Defines a cookie to be sent to the server on every request.
 WebResponse getResponse(WebRequest request)
          Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server.
 java.lang.String getUserAgent()
          Returns the current user agent setting.
 void setAuthorization(java.lang.String userName, java.lang.String password)
          Sets a username and password for a basic authentication scheme.
 void setUserAgent(java.lang.String userAgent)
          Specifies the user agent identification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebConversation

public WebConversation()
Creates a new web conversation.
Method Detail

getResponse

public WebResponse getResponse(WebRequest request)
                        throws java.net.MalformedURLException,
                               java.io.IOException
Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server.

addCookie

public void addCookie(java.lang.String name,
                      java.lang.String value)
Defines a cookie to be sent to the server on every request.

setUserAgent

public void setUserAgent(java.lang.String userAgent)
Specifies the user agent identification. Used to trigger browser-specific server behavior.

getUserAgent

public java.lang.String getUserAgent()
Returns the current user agent setting.

setAuthorization

public void setAuthorization(java.lang.String userName,
                             java.lang.String password)
Sets a username and password for a basic authentication scheme.