com.sun.slamd.scripting.http
Class HTTPClientVariable

java.lang.Object
  extended bycom.sun.slamd.scripting.engine.Variable
      extended bycom.sun.slamd.scripting.http.HTTPClientVariable
All Implemented Interfaces:
Argument

public class HTTPClientVariable
extends Variable

This class defines a variable that can be used to manage the interaction with one or more servers using HTTP 1.1. An HTTP client variable provides the following methods:


Field Summary
static java.lang.String BLIND_TRUST_METHOD_NAME
          The name of the method that can be used to determine whether the client has been configured to blindly trust any SSL certificate.
static int BLIND_TRUST_METHOD_NUMBER
          The method number for the "blindTrust" method.
static java.lang.String CLEAR_COOKIES_METHOD_NAME
          The name of the method that can be used to clear all cookie information associated with this HTTP client.
static int CLEAR_COOKIES_METHOD_NUMBER
          The method number for the "clearCookies" method.
static java.lang.String CLOSE_ALL_METHOD_NAME
          The name of the method that can be used to close all connections associated with this HTTP client.
static int CLOSE_ALL_METHOD_NUMBER
          The method number for the "closeAll" method.
static java.lang.String COOKIES_ENABLED_METHOD_NAME
          The name of the method that can be used to determine if cookie support is enabled.
static int COOKIES_ENABLED_METHOD_NUMBER
          The method number for the "cookiesEnabled" method.
static java.lang.String DISABLE_AUTHENTICATION_METHOD_NAME
          The name of the method that indicates that no authentication information should be included in requests sent using this client.
static int DISABLE_AUTHENTICATION_METHOD_NUMBER
          The method number for the "disableAuthentication" method.
static java.lang.String DISABLE_DEBUG_MODE_METHOD_NAME
          The name of the method that indicates that the client should stop operating in debug mode.
static int DISABLE_DEBUG_MODE_METHOD_NUMBER
          The method number for the "disableDebugMode" method.
static java.lang.String DISABLE_PROXY_METHOD_NAME
          The name of the method that indicates that no proxy server should be used when sending requests using this client.
static int DISABLE_PROXY_METHOD_NUMBER
          The method number for the "disableProxy" method.
static java.lang.String DISABLE_STATISTICS_METHOD_NAME
          The name of the method that indicates that statistics collection should be disabled.
static int DISABLE_STATISTICS_METHOD_NUMBER
          The method number for the "disableStatistics" method.
static java.lang.String ENABLE_AUTHENTICATION_METHOD_NAME
          The name of the method that indicates that authentication should be used when sending requests using this client.
static int ENABLE_AUTHENTICATION_METHOD_NUMBER
          The method number for the "enableAuthentication" method.
static java.lang.String ENABLE_DEBUG_MODE_METHOD_NAME
          The name of the method that indicates that the client should operate in debug mode.
static int ENABLE_DEBUG_MODE_METHOD_NUMBER
          The method number for the "enableDebugMode" method.
static int ENABLE_PROXY_1_METHOD_NUMBER
          The method number for the first "enableProxy" method.
static int ENABLE_PROXY_2_METHOD_NUMBER
          The method number for the second "enableProxy" method.
static java.lang.String ENABLE_PROXY_METHOD_NAME
          The name of the method that indicates that requests sent using this client should be forwarded through a proxy server.
static java.lang.String ENABLE_STATISTICS_METHOD_NAME
          The name of the method that indicates whether the client should maintain a number of statistics about the request processing.
static int ENABLE_STATISTICS_METHOD_NUMBER
          The method number for the "enableStatistics" method.
static java.lang.String FOLLOW_REDIRECTS_METHOD_NAME
          The name of the method that indicates whether this client will automatically follow redirects encountered while processing requests.
static int FOLLOW_REDIRECTS_METHOD_NUMBER
          The method number for the "followRedirects" method.
static java.lang.String GET_FAILURE_REASON_METHOD_NAME
          The name of the method that can be used to determine the reason for the failure of the last operation processed using this client.
static int GET_FAILURE_REASON_METHOD_NUMBER
          The method number for the "getFailureReason" method.
static Method[] HTTP_CLIENT_VARIABLE_METHODS
          The set of methods associated with HTTP client variables.
static java.lang.String HTTP_CLIENT_VARIABLE_TYPE
          The name that will be used for the data type of HTTP client variables.
static java.lang.String REMOVE_COMMON_HEADER_METHOD_NAME
          The name of the method that can be used to remove a common header from this client.
static int REMOVE_COMMON_HEADER_METHOD_NUMBER
          The method number for the "removeCommonHeader" method.
static java.lang.String RETRIEVE_ASSOCIATED_FILES_METHOD_NAME
          The name of the method that indicates whether this client will automatically retrieve any files associated with an HTML document retrieved as part of processing requests.
static int RETRIEVE_ASSOCIATED_FILES_METHOD_NUMBER
          The method number for the "retrieveAssociatedFiles" method.
static int SEND_REQUEST_1_METHOD_NUMBER
          The method number for the first "sendRequest" method.
static int SEND_REQUEST_2_METHOD_NUMBER
          The method number for the second "sendRequest" method.
static java.lang.String SEND_REQUEST_METHOD_NAME
          The name of the method that may be used to send a request using this HTTP client.
static java.lang.String SET_BLIND_TRUST_METHOD_NAME
          The name of the method that can be used to specify whether the client should blindly trust any SSL certificate.
static int SET_BLIND_TRUST_METHOD_NUMBER
          The method number for the "setBlindTrust" method.
static java.lang.String SET_COMMON_HEADER_METHOD_NAME
          The name of the method that can be used to set a common header to include in all requests sent using this client.
static int SET_COMMON_HEADER_METHOD_NUMBER
          The method number for the "setCommonHeader" method.
static java.lang.String SET_COOKIES_ENABLED_METHOD_NAME
          The name of the method that can be used to specify whether cookie support should be enabled.
static int SET_COOKIES_ENABLED_METHOD_NUMBER
          The method number for the "setCookiesEnabled" method.
static java.lang.String SET_FOLLOW_REDIRECTS_METHOD_NAME
          The name of the method that specifies whether this HTTP client should automatically follow any redirects encountered while processing requests.
static int SET_FOLLOW_REDIRECTS_METHOD_NUMBER
          The method number for the "setFollowRedirects" method.
static java.lang.String SET_RETRIEVE_ASSOCIATED_FILES_METHOD_NAME
          The name of the method that specifies whether this HTTP client should automatically retrieve any files associated with an HTML document retrieved as part of processing requests.
static int SET_RETRIEVE_ASSOCIATED_FILES_METHOD_NUMBER
          The method number for the "setRetrieveAssociatedFiles" method.
static java.lang.String SET_USE_KEEPALIVE_METHOD_NAME
          The name of the method that specifies whether this HTTP client should use keep-alive in order to try to reuse a connection for multiple requests.
static int SET_USE_KEEPALIVE_METHOD_NUMBER
          The method number for the "setUseKeepAlive" method.
static java.lang.String USE_KEEPALIVE_METHOD_NAME
          The name of the method that indicates whether this client will use keep-alive in order to try to reuse a connection for multiple requests.
static int USE_KEEPALIVE_METHOD_NUMBER
          The method number for the "useKeepAlive" method.
 
Constructor Summary
HTTPClientVariable()
          Creates a new variable with no name, to be used only when creating a variable with Class.newInstance(), and only when setName() is called after that to set the name.
 
Method Summary
 void assign(Argument argument)
          Assigns the value of the provided argument to this variable.
 Variable executeMethod(int lineNumber, int methodNumber, Argument[] arguments)
          Executes the specified method, using the provided variables as arguments to the method, and makes the return value available to the caller.
 int getMethodNumber(java.lang.String methodName, java.lang.String[] argumentTypes)
          Retrieves the method number for the method that has the specified name and argument types, or -1 if there is no such method.
 Method[] getMethods()
          Retrieves a list of all methods defined for this variable.
 java.lang.String getReturnTypeForMethod(java.lang.String methodName, java.lang.String[] argumentTypes)
          Retrieves the return type for the method with the specified name and argument types.
 StatTracker[] getStatTrackers()
          Retrieves the stat trackers that have been maintained for this LDAP connection variable.
 java.lang.String getValueAsString()
          Retrieves a string representation of the value of this argument.
 java.lang.String getVariableTypeName()
          Retrieves the name of the variable type for this variable.
 boolean hasMethod(java.lang.String methodName)
          Indicates whether this variable type has a method with the specified name.
 void startStatTrackers(JobClass jobThread)
          Starts the stat trackers associated with this variable.
 void stopStatTrackers()
          Stops the stat trackers associated with this variable.
 
Methods inherited from class com.sun.slamd.scripting.engine.Variable
getArgumentAsString, getArgumentType, getArgumentValue, getName, isValidIdentifier, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_CLIENT_VARIABLE_TYPE

public static final java.lang.String HTTP_CLIENT_VARIABLE_TYPE
The name that will be used for the data type of HTTP client variables.

See Also:
Constant Field Values

BLIND_TRUST_METHOD_NAME

public static final java.lang.String BLIND_TRUST_METHOD_NAME
The name of the method that can be used to determine whether the client has been configured to blindly trust any SSL certificate.

See Also:
Constant Field Values

BLIND_TRUST_METHOD_NUMBER

public static final int BLIND_TRUST_METHOD_NUMBER
The method number for the "blindTrust" method.

See Also:
Constant Field Values

CLEAR_COOKIES_METHOD_NAME

public static final java.lang.String CLEAR_COOKIES_METHOD_NAME
The name of the method that can be used to clear all cookie information associated with this HTTP client.

See Also:
Constant Field Values

CLEAR_COOKIES_METHOD_NUMBER

public static final int CLEAR_COOKIES_METHOD_NUMBER
The method number for the "clearCookies" method.

See Also:
Constant Field Values

CLOSE_ALL_METHOD_NAME

public static final java.lang.String CLOSE_ALL_METHOD_NAME
The name of the method that can be used to close all connections associated with this HTTP client.

See Also:
Constant Field Values

CLOSE_ALL_METHOD_NUMBER

public static final int CLOSE_ALL_METHOD_NUMBER
The method number for the "closeAll" method.

See Also:
Constant Field Values

COOKIES_ENABLED_METHOD_NAME

public static final java.lang.String COOKIES_ENABLED_METHOD_NAME
The name of the method that can be used to determine if cookie support is enabled.

See Also:
Constant Field Values

COOKIES_ENABLED_METHOD_NUMBER

public static final int COOKIES_ENABLED_METHOD_NUMBER
The method number for the "cookiesEnabled" method.

See Also:
Constant Field Values

DISABLE_AUTHENTICATION_METHOD_NAME

public static final java.lang.String DISABLE_AUTHENTICATION_METHOD_NAME
The name of the method that indicates that no authentication information should be included in requests sent using this client.

See Also:
Constant Field Values

DISABLE_AUTHENTICATION_METHOD_NUMBER

public static final int DISABLE_AUTHENTICATION_METHOD_NUMBER
The method number for the "disableAuthentication" method.

See Also:
Constant Field Values

DISABLE_DEBUG_MODE_METHOD_NAME

public static final java.lang.String DISABLE_DEBUG_MODE_METHOD_NAME
The name of the method that indicates that the client should stop operating in debug mode.

See Also:
Constant Field Values

DISABLE_DEBUG_MODE_METHOD_NUMBER

public static final int DISABLE_DEBUG_MODE_METHOD_NUMBER
The method number for the "disableDebugMode" method.

See Also:
Constant Field Values

DISABLE_PROXY_METHOD_NAME

public static final java.lang.String DISABLE_PROXY_METHOD_NAME
The name of the method that indicates that no proxy server should be used when sending requests using this client.

See Also:
Constant Field Values

DISABLE_PROXY_METHOD_NUMBER

public static final int DISABLE_PROXY_METHOD_NUMBER
The method number for the "disableProxy" method.

See Also:
Constant Field Values

DISABLE_STATISTICS_METHOD_NAME

public static final java.lang.String DISABLE_STATISTICS_METHOD_NAME
The name of the method that indicates that statistics collection should be disabled.

See Also:
Constant Field Values

DISABLE_STATISTICS_METHOD_NUMBER

public static final int DISABLE_STATISTICS_METHOD_NUMBER
The method number for the "disableStatistics" method.

See Also:
Constant Field Values

ENABLE_AUTHENTICATION_METHOD_NAME

public static final java.lang.String ENABLE_AUTHENTICATION_METHOD_NAME
The name of the method that indicates that authentication should be used when sending requests using this client.

See Also:
Constant Field Values

ENABLE_AUTHENTICATION_METHOD_NUMBER

public static final int ENABLE_AUTHENTICATION_METHOD_NUMBER
The method number for the "enableAuthentication" method.

See Also:
Constant Field Values

ENABLE_DEBUG_MODE_METHOD_NAME

public static final java.lang.String ENABLE_DEBUG_MODE_METHOD_NAME
The name of the method that indicates that the client should operate in debug mode.

See Also:
Constant Field Values

ENABLE_DEBUG_MODE_METHOD_NUMBER

public static final int ENABLE_DEBUG_MODE_METHOD_NUMBER
The method number for the "enableDebugMode" method.

See Also:
Constant Field Values

ENABLE_PROXY_METHOD_NAME

public static final java.lang.String ENABLE_PROXY_METHOD_NAME
The name of the method that indicates that requests sent using this client should be forwarded through a proxy server.

See Also:
Constant Field Values

ENABLE_PROXY_1_METHOD_NUMBER

public static final int ENABLE_PROXY_1_METHOD_NUMBER
The method number for the first "enableProxy" method.

See Also:
Constant Field Values

ENABLE_PROXY_2_METHOD_NUMBER

public static final int ENABLE_PROXY_2_METHOD_NUMBER
The method number for the second "enableProxy" method.

See Also:
Constant Field Values

ENABLE_STATISTICS_METHOD_NAME

public static final java.lang.String ENABLE_STATISTICS_METHOD_NAME
The name of the method that indicates whether the client should maintain a number of statistics about the request processing.

See Also:
Constant Field Values

ENABLE_STATISTICS_METHOD_NUMBER

public static final int ENABLE_STATISTICS_METHOD_NUMBER
The method number for the "enableStatistics" method.

See Also:
Constant Field Values

FOLLOW_REDIRECTS_METHOD_NAME

public static final java.lang.String FOLLOW_REDIRECTS_METHOD_NAME
The name of the method that indicates whether this client will automatically follow redirects encountered while processing requests.

See Also:
Constant Field Values

FOLLOW_REDIRECTS_METHOD_NUMBER

public static final int FOLLOW_REDIRECTS_METHOD_NUMBER
The method number for the "followRedirects" method.

See Also:
Constant Field Values

GET_FAILURE_REASON_METHOD_NAME

public static final java.lang.String GET_FAILURE_REASON_METHOD_NAME
The name of the method that can be used to determine the reason for the failure of the last operation processed using this client.

See Also:
Constant Field Values

GET_FAILURE_REASON_METHOD_NUMBER

public static final int GET_FAILURE_REASON_METHOD_NUMBER
The method number for the "getFailureReason" method.

See Also:
Constant Field Values

REMOVE_COMMON_HEADER_METHOD_NAME

public static final java.lang.String REMOVE_COMMON_HEADER_METHOD_NAME
The name of the method that can be used to remove a common header from this client.

See Also:
Constant Field Values

REMOVE_COMMON_HEADER_METHOD_NUMBER

public static final int REMOVE_COMMON_HEADER_METHOD_NUMBER
The method number for the "removeCommonHeader" method.

See Also:
Constant Field Values

RETRIEVE_ASSOCIATED_FILES_METHOD_NAME

public static final java.lang.String RETRIEVE_ASSOCIATED_FILES_METHOD_NAME
The name of the method that indicates whether this client will automatically retrieve any files associated with an HTML document retrieved as part of processing requests.

See Also:
Constant Field Values

RETRIEVE_ASSOCIATED_FILES_METHOD_NUMBER

public static final int RETRIEVE_ASSOCIATED_FILES_METHOD_NUMBER
The method number for the "retrieveAssociatedFiles" method.

See Also:
Constant Field Values

SEND_REQUEST_METHOD_NAME

public static final java.lang.String SEND_REQUEST_METHOD_NAME
The name of the method that may be used to send a request using this HTTP client.

See Also:
Constant Field Values

SEND_REQUEST_1_METHOD_NUMBER

public static final int SEND_REQUEST_1_METHOD_NUMBER
The method number for the first "sendRequest" method.

See Also:
Constant Field Values

SEND_REQUEST_2_METHOD_NUMBER

public static final int SEND_REQUEST_2_METHOD_NUMBER
The method number for the second "sendRequest" method.

See Also:
Constant Field Values

SET_BLIND_TRUST_METHOD_NAME

public static final java.lang.String SET_BLIND_TRUST_METHOD_NAME
The name of the method that can be used to specify whether the client should blindly trust any SSL certificate.

See Also:
Constant Field Values

SET_BLIND_TRUST_METHOD_NUMBER

public static final int SET_BLIND_TRUST_METHOD_NUMBER
The method number for the "setBlindTrust" method.

See Also:
Constant Field Values

SET_COMMON_HEADER_METHOD_NAME

public static final java.lang.String SET_COMMON_HEADER_METHOD_NAME
The name of the method that can be used to set a common header to include in all requests sent using this client.

See Also:
Constant Field Values

SET_COMMON_HEADER_METHOD_NUMBER

public static final int SET_COMMON_HEADER_METHOD_NUMBER
The method number for the "setCommonHeader" method.

See Also:
Constant Field Values

SET_COOKIES_ENABLED_METHOD_NAME

public static final java.lang.String SET_COOKIES_ENABLED_METHOD_NAME
The name of the method that can be used to specify whether cookie support should be enabled.

See Also:
Constant Field Values

SET_COOKIES_ENABLED_METHOD_NUMBER

public static final int SET_COOKIES_ENABLED_METHOD_NUMBER
The method number for the "setCookiesEnabled" method.

See Also:
Constant Field Values

SET_FOLLOW_REDIRECTS_METHOD_NAME

public static final java.lang.String SET_FOLLOW_REDIRECTS_METHOD_NAME
The name of the method that specifies whether this HTTP client should automatically follow any redirects encountered while processing requests.

See Also:
Constant Field Values

SET_FOLLOW_REDIRECTS_METHOD_NUMBER

public static final int SET_FOLLOW_REDIRECTS_METHOD_NUMBER
The method number for the "setFollowRedirects" method.

See Also:
Constant Field Values

SET_RETRIEVE_ASSOCIATED_FILES_METHOD_NAME

public static final java.lang.String SET_RETRIEVE_ASSOCIATED_FILES_METHOD_NAME
The name of the method that specifies whether this HTTP client should automatically retrieve any files associated with an HTML document retrieved as part of processing requests.

See Also:
Constant Field Values

SET_RETRIEVE_ASSOCIATED_FILES_METHOD_NUMBER

public static final int SET_RETRIEVE_ASSOCIATED_FILES_METHOD_NUMBER
The method number for the "setRetrieveAssociatedFiles" method.

See Also:
Constant Field Values

SET_USE_KEEPALIVE_METHOD_NAME

public static final java.lang.String SET_USE_KEEPALIVE_METHOD_NAME
The name of the method that specifies whether this HTTP client should use keep-alive in order to try to reuse a connection for multiple requests.

See Also:
Constant Field Values

SET_USE_KEEPALIVE_METHOD_NUMBER

public static final int SET_USE_KEEPALIVE_METHOD_NUMBER
The method number for the "setUseKeepAlive" method.

See Also:
Constant Field Values

USE_KEEPALIVE_METHOD_NAME

public static final java.lang.String USE_KEEPALIVE_METHOD_NAME
The name of the method that indicates whether this client will use keep-alive in order to try to reuse a connection for multiple requests.

See Also:
Constant Field Values

USE_KEEPALIVE_METHOD_NUMBER

public static final int USE_KEEPALIVE_METHOD_NUMBER
The method number for the "useKeepAlive" method.

See Also:
Constant Field Values

HTTP_CLIENT_VARIABLE_METHODS

public static final Method[] HTTP_CLIENT_VARIABLE_METHODS
The set of methods associated with HTTP client variables.

Constructor Detail

HTTPClientVariable

public HTTPClientVariable()
                   throws ScriptException
Creates a new variable with no name, to be used only when creating a variable with Class.newInstance(), and only when setName() is called after that to set the name.

Throws:
ScriptException - If a problem occurs while initializing the new variable.
Method Detail

getVariableTypeName

public java.lang.String getVariableTypeName()
Retrieves the name of the variable type for this variable.

Specified by:
getVariableTypeName in class Variable
Returns:
The name of the variable type for this variable.

startStatTrackers

public void startStatTrackers(JobClass jobThread)
Starts the stat trackers associated with this variable.

Overrides:
startStatTrackers in class Variable
Parameters:
jobThread - The job thread with which the stat trackers are associated.

stopStatTrackers

public void stopStatTrackers()
Stops the stat trackers associated with this variable.

Overrides:
stopStatTrackers in class Variable

getStatTrackers

public StatTracker[] getStatTrackers()
Retrieves the stat trackers that have been maintained for this LDAP connection variable.

Overrides:
getStatTrackers in class Variable
Returns:
The stat trackers that have been maintained for this LDAP connection variable.

getMethods

public Method[] getMethods()
Retrieves a list of all methods defined for this variable.

Specified by:
getMethods in class Variable
Returns:
A list of all methods defined for this variable.

hasMethod

public boolean hasMethod(java.lang.String methodName)
Indicates whether this variable type has a method with the specified name.

Specified by:
hasMethod in class Variable
Parameters:
methodName - The name of the method.
Returns:
true if this variable has a method with the specified name, or false if it does not.

getMethodNumber

public int getMethodNumber(java.lang.String methodName,
                           java.lang.String[] argumentTypes)
Retrieves the method number for the method that has the specified name and argument types, or -1 if there is no such method.

Specified by:
getMethodNumber in class Variable
Parameters:
methodName - The name of the method.
argumentTypes - The list of argument types for the method.
Returns:
The method number for the method that has the specified name and argument types.

getReturnTypeForMethod

public java.lang.String getReturnTypeForMethod(java.lang.String methodName,
                                               java.lang.String[] argumentTypes)
Retrieves the return type for the method with the specified name and argument types.

Specified by:
getReturnTypeForMethod in class Variable
Parameters:
methodName - The name of the method.
argumentTypes - The set of argument types for the method.
Returns:
The return type for the method, or null if there is no such method defined.

executeMethod

public Variable executeMethod(int lineNumber,
                              int methodNumber,
                              Argument[] arguments)
                       throws ScriptException
Executes the specified method, using the provided variables as arguments to the method, and makes the return value available to the caller.

Specified by:
executeMethod in class Variable
Parameters:
lineNumber - The line number of the script in which the method call occurs.
methodNumber - The method number of the method to execute.
arguments - The set of arguments to use for the method.
Returns:
The value returned from the method, or null if it does not return a value.
Throws:
ScriptException - If the specified method does not exist, or if a problem occurs while attempting to execute it.

assign

public void assign(Argument argument)
            throws ScriptException
Assigns the value of the provided argument to this variable. The value of the provided argument must be of the same type as this variable.

Specified by:
assign in class Variable
Parameters:
argument - The argument whose value should be assigned to this variable.
Throws:
ScriptException - If a problem occurs while performing the assignment.

getValueAsString

public java.lang.String getValueAsString()
Retrieves a string representation of the value of this argument.

Returns:
A string representation of the value of this argument.