net.grinder.plugin.http
Class HTTPPluginControl

java.lang.Object
  extended by net.grinder.plugin.http.HTTPPluginControl

public final class HTTPPluginControl
extends java.lang.Object

Facade through which the script can control the behaviour of the HTTP plug-in.

Author:
Philip Aston

Method Summary
static HTTPPluginConnection getConnectionDefaults()
          Returns a HTTPPluginConnection that can be used to set the default behaviour of new connections.
static HTTPUtilities getHTTPUtilities()
          Provides access to an HTTPUtilities instance.
static HTTPPluginConnection getThreadConnection(java.lang.String url)
          Returns a HTTPPluginConnection for a particular URL.
static java.lang.Object getThreadHTTPClientContext()
          Returns the HTTPClient context object for the calling worker thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnectionDefaults

public static HTTPPluginConnection getConnectionDefaults()
Returns a HTTPPluginConnection that can be used to set the default behaviour of new connections.

Returns:
An HTTPPluginConnection.

getThreadConnection

public static HTTPPluginConnection getThreadConnection(java.lang.String url)
                                                throws GrinderException,
                                                       ParseException,
                                                       ProtocolNotSuppException
Returns a HTTPPluginConnection for a particular URL.

The resulting HTTPPluginConnection is valid for the current thread and the current run. It can be used to set specific authentication details, default headers, cookies, proxy servers, and so on for the current thread/run on a per-URL basis.

This method will throw a GrinderException if not called from a worker thread.

Parameters:
url - An absolute URL that specifies the connection.
Returns:
a HTTPPluginConnection value
Throws:
GrinderException - If an error occurs.
ParseException - If url can not be parsed.
ProtocolNotSuppException - If url specifies an unsupported protocol.

getThreadHTTPClientContext

public static java.lang.Object getThreadHTTPClientContext()
                                                   throws GrinderException
Returns the HTTPClient context object for the calling worker thread. This is useful when calling HTTPClient methods directly, e.g. CookieModule.listAllCookies(Object).

This method will throw a GrinderException if not called from a worker thread.

Returns:
The context object used for HTTPClient.HTTPConnections created by this thread.
Throws:
GrinderException - If an error occurs.

getHTTPUtilities

public static HTTPUtilities getHTTPUtilities()
Provides access to an HTTPUtilities instance.

Returns:
The utilities instance.