Apache JMeter

org.apache.jmeter.protocol.http.sampler
Class HTTPSamplerBase

java.lang.Object
  extended byorg.apache.jmeter.testelement.AbstractTestElement
      extended byorg.apache.jmeter.samplers.AbstractSampler
          extended byorg.apache.jmeter.protocol.http.sampler.HTTPSamplerBase
All Implemented Interfaces:
Cloneable, Sampler, Serializable, TestElement, TestListener, ThreadListener
Direct Known Subclasses:
AjpSampler, HTTPSampler, HTTPSampler2, WebServiceSampler

public abstract class HTTPSamplerBase
extends AbstractSampler
implements TestListener, ThreadListener

Common constants and methods for HTTP samplers

See Also:
Serialized Form

Field Summary
static String APPLICATION_X_WWW_FORM_URLENCODED
           
static String ARGUMENTS
           
static String AUTH_MANAGER
           
static String AUTO_REDIRECTS
           
protected static String CONNECTION_CLOSE
           
static String CONTENT_ENCODING
           
static String CONTENT_TYPE
           
static String COOKIE_MANAGER
           
static int DEFAULT_HTTP_PORT
           
static String DEFAULT_HTTP_PORT_STRING
           
static int DEFAULT_HTTPS_PORT
           
static String DEFAULT_METHOD
           
static String DEFAULT_PROTOCOL
           
static String DELETE
           
static String DO_MULTIPART_POST
           
static String DOMAIN
           
static String EMBEDDED_URL_RE
           
protected static String ENCODING_GZIP
           
static String FILE_DATA
           
static String FILE_FIELD
           
static String FILE_MIMETYPE
           
static String FILE_NAME
           
static String FOLLOW_REDIRECTS
           
static String GET
           
static String HEAD
           
protected static String HEADER_AUTHORIZATION
           
protected static String HEADER_CONNECTION
           
protected static String HEADER_CONTENT_DISPOSITION
           
protected static String HEADER_CONTENT_ENCODING
           
protected static String HEADER_CONTENT_LENGTH
           
protected static String HEADER_CONTENT_TYPE
           
protected static String HEADER_COOKIE
           
protected static String HEADER_LOCATION
           
static String HEADER_MANAGER
           
protected static String HEADER_SET_COOKIE
           
protected static String HTTP_1_1
           
static String IMAGE_PARSER
           
static String IMPLEMENTATION
           
protected static String KEEP_ALIVE
           
protected static int MAX_FRAME_DEPTH
           
protected static int MAX_REDIRECTS
           
static String METHOD
           
static List METHODLIST
           
static String MIMETYPE
           
static String MONITOR
           
static String MULTIPART_FORM
           
static String MULTIPART_FORM_DATA
           
protected static String NON_HTTP_RESPONSE_CODE
           
protected static String NON_HTTP_RESPONSE_MESSAGE
           
static String NORMAL_FORM
           
static String OPTIONS
           
static String PATH
           
static String PORT
           
static String POST
           
static String PROTOCOL
           
static String PROTOCOL_HTTP
           
static String PROTOCOL_HTTPS
           
static String PUT
           
static String TRACE
           
protected static String TRANSFER_ENCODING
           
static int UNSPECIFIED_PORT
          A number to indicate that the port has not been set
static String UNSPECIFIED_PORT_AS_STRING
           
static String URL
           
static String USE_KEEPALIVE
           
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
HTTPSamplerBase()
           
 
Method Summary
 void addArgument(String name, String value)
           
 void addArgument(String name, String value, String metadata)
           
 void addEncodedArgument(String name, String value)
          Add an argument which has already been encoded
 void addEncodedArgument(String name, String value, String metaData)
           
 void addEncodedArgument(String name, String value, String metaData, String contentEncoding)
           
 void addNonEncodedArgument(String name, String value, String metadata)
           
 void addTestElement(TestElement el)
           
 Object clone()
           
protected  HTTPSampleResult downloadPageResources(HTTPSampleResult res, HTTPSampleResult container, int frameDepth)
          Download the resources of an HTML page.
protected static String encodeBackSlashes(String value)
           
protected  String encodeSpaces(String path)
           
protected  HTTPSampleResult errorResult(Throwable e, HTTPSampleResult res)
          Obtain a result that will help inform the user that an error has occured during sampling, and how long it took to detect the error.
protected  HTTPSampleResult followRedirects(HTTPSampleResult res, int frameDepth)
          Iteratively download the redirect targets of a redirect response.
 Arguments getArguments()
           
 AuthManager getAuthManager()
           
 boolean getAutoRedirects()
           
 String getContentEncoding()
           
 CookieManager getCookieManager()
           
static int getDefaultPort(String protocol, int port)
           
 String getDomain()
           
 boolean getDoMultipartPost()
           
 String getEmbeddedUrlRE()
          Get the regular expression URLs must match.
 String getFileField()
          The name parameter to be applied to the file
 String getFilename()
          The actual name of the file to POST
 boolean getFollowRedirects()
           
 HeaderManager getHeaderManager()
           
 String getImplementation()
           
 String getMethod()
           
 String getMimetype()
           
 String getMonitor()
           
 String getPath()
           
 int getPort()
           
 String getProtocol()
           
 String getQueryString()
          Gets the QueryString attribute of the UrlConfig object, using UTF-8 to encode the URL
 String getQueryString(String contentEncoding)
          Gets the QueryString attribute of the UrlConfig object, using the specified encoding to encode the parameter values put into the URL
 boolean getSendFileAsPostBody()
          Determine if the file should be sent as the entire Post body, i.e. without any additional wrapping
 boolean getSendParameterValuesAsPostBody()
          Determine if none of the parameters have a name, and if that is the case, it means that the parameter values should be sent as the post body
 URL getUrl()
          Get the URL, built from its component parts.
 boolean getUseKeepAlive()
           
 boolean getUseMultipartForPost()
          Determine if we should use multipart/form-data or application/x-www-form-urlencoded for the post
static String[] getValidMethodsAsArray()
           
protected  boolean hasUploadableFiles()
          Method to tell if the request has any files to be uploaded
 boolean isImageParser()
           
 boolean isMonitor()
           
 boolean isProtocolDefaultPort()
          Tell whether the default port for the specified protocol is used
static boolean isSecure(String protocol)
           
static boolean isSecure(URL url)
           
protected  boolean isSuccessCode(int code)
          Determine if the HTTP status code is successful or not i.e. in range 200 to 399 inclusive
 void parseArguments(String queryString)
           
 void parseArguments(String queryString, String contentEncoding)
          This method allows a proxy server to send over the raw text from a browser's output stream to be parsed and stored correctly into the UrlConfig object.
protected  HTTPSampleResult resultProcessing(boolean areFollowingRedirect, int frameDepth, HTTPSampleResult res)
          Follow redirects and download page resources if appropriate. this works, but the container stuff here is what's doing it. followRedirects() is actually doing the work to make sure we have only one container to make this work more naturally, I think this method - sample() - needs to take an HTTPSamplerResult container parameter instead of a boolean:areFollowingRedirect.
 SampleResult sample()
          Perform a sample, and return the results
 SampleResult sample(Entry e)
          Do a sampling and return its results.
protected abstract  HTTPSampleResult sample(URL u, String method, boolean areFollowingRedirect, int depth)
          Samples the URL passed in and stores the result in HTTPSampleResult, following redirects and downloading page resources as appropriate.
 void setArguments(Arguments value)
           
 void setAuthManager(AuthManager value)
           
 void setAutoRedirects(boolean value)
           
 void setContentEncoding(String value)
           
 void setCookieManager(CookieManager value)
           
 void setDomain(String value)
           
 void setDoMultipartPost(boolean value)
           
 void setEmbeddedUrlRE(String regex)
           
 void setFileField(String value)
          The name parameter to be applied to the file
 void setFilename(String value)
          The actual name of the file to POST
 void setFollowRedirects(boolean value)
           
 void setHeaderManager(HeaderManager value)
           
 void setImageParser(boolean parseImages)
           
 void setImplementation(String value)
           
 void setMethod(String value)
           
 void setMimetype(String value)
           
 void setMonitor(boolean truth)
           
 void setMonitor(String value)
           
 void setPath(String path)
          Sets the Path attribute of the UrlConfig object Also calls parseArguments to extract and store any query arguments
 void setPath(String path, String contentEncoding)
          Sets the Path attribute of the UrlConfig object Also calls parseArguments to extract and store any query arguments
 void setPort(int value)
           
 void setProtocol(String value)
           
 void setUseKeepAlive(boolean value)
           
 void testEnded()
          Called once for all threads after the end of a test.
 void testEnded(String host)
          Called once for all threads after the end of a test.
 void testIterationStart(LoopIterationEvent event)
          Each time through a Thread Group's test script, an iteration event is fired for each thread.
 void testStarted()
          Called just before the start of the test from the main engine thread.
 void testStarted(String host)
          Called just before the start of the test from the main engine thread.
 void threadFinished()
          Called once for each thread at the end of a test
 void threadStarted()
          Called just before the start of the thread
 String toString()
           
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, canRemove, clear, clearTemporary, emptyTemporary, equals, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, nextIsNull, propertyIterator, recoverRunningVersion, removeProperty, setName, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jmeter.testelement.TestElement
canRemove, clear, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setName, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
 

Field Detail

DEFAULT_HTTPS_PORT

public static final int DEFAULT_HTTPS_PORT
See Also:
Constant Field Values

DEFAULT_HTTP_PORT

public static final int DEFAULT_HTTP_PORT
See Also:
Constant Field Values

DEFAULT_HTTP_PORT_STRING

public static final String DEFAULT_HTTP_PORT_STRING
See Also:
Constant Field Values

ARGUMENTS

public static final String ARGUMENTS
See Also:
Constant Field Values

AUTH_MANAGER

public static final String AUTH_MANAGER
See Also:
Constant Field Values

COOKIE_MANAGER

public static final String COOKIE_MANAGER
See Also:
Constant Field Values

HEADER_MANAGER

public static final String HEADER_MANAGER
See Also:
Constant Field Values

MIMETYPE

public static final String MIMETYPE
See Also:
Constant Field Values

DOMAIN

public static final String DOMAIN
See Also:
Constant Field Values

PORT

public static final String PORT
See Also:
Constant Field Values

METHOD

public static final String METHOD
See Also:
Constant Field Values

CONTENT_ENCODING

public static final String CONTENT_ENCODING
See Also:
Constant Field Values

IMPLEMENTATION

public static final String IMPLEMENTATION
See Also:
Constant Field Values

PATH

public static final String PATH
See Also:
Constant Field Values

FOLLOW_REDIRECTS

public static final String FOLLOW_REDIRECTS
See Also:
Constant Field Values

AUTO_REDIRECTS

public static final String AUTO_REDIRECTS
See Also:
Constant Field Values

PROTOCOL

public static final String PROTOCOL
See Also:
Constant Field Values

PROTOCOL_HTTP

public static final String PROTOCOL_HTTP
See Also:
Constant Field Values

PROTOCOL_HTTPS

public static final String PROTOCOL_HTTPS
See Also:
Constant Field Values

DEFAULT_PROTOCOL

public static final String DEFAULT_PROTOCOL
See Also:
Constant Field Values

URL

public static final String URL
See Also:
Constant Field Values

HEAD

public static final String HEAD
See Also:
Constant Field Values

POST

public static final String POST
See Also:
Constant Field Values

PUT

public static final String PUT
See Also:
Constant Field Values

GET

public static final String GET
See Also:
Constant Field Values

OPTIONS

public static final String OPTIONS
See Also:
Constant Field Values

TRACE

public static final String TRACE
See Also:
Constant Field Values

DELETE

public static final String DELETE
See Also:
Constant Field Values

DEFAULT_METHOD

public static final String DEFAULT_METHOD
See Also:
Constant Field Values

METHODLIST

public static final List METHODLIST

USE_KEEPALIVE

public static final String USE_KEEPALIVE
See Also:
Constant Field Values

FILE_NAME

public static final String FILE_NAME
See Also:
Constant Field Values

DO_MULTIPART_POST

public static final String DO_MULTIPART_POST
See Also:
Constant Field Values

FILE_FIELD

public static final String FILE_FIELD
See Also:
Constant Field Values

FILE_DATA

public static final String FILE_DATA
See Also:
Constant Field Values

FILE_MIMETYPE

public static final String FILE_MIMETYPE
See Also:
Constant Field Values

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also:
Constant Field Values

NORMAL_FORM

public static final String NORMAL_FORM
See Also:
Constant Field Values

MULTIPART_FORM

public static final String MULTIPART_FORM
See Also:
Constant Field Values

IMAGE_PARSER

public static final String IMAGE_PARSER
See Also:
Constant Field Values

EMBEDDED_URL_RE

public static final String EMBEDDED_URL_RE
See Also:
Constant Field Values

MONITOR

public static final String MONITOR
See Also:
Constant Field Values

UNSPECIFIED_PORT

public static final int UNSPECIFIED_PORT
A number to indicate that the port has not been set. *

See Also:
Constant Field Values

UNSPECIFIED_PORT_AS_STRING

public static final String UNSPECIFIED_PORT_AS_STRING
See Also:
Constant Field Values

NON_HTTP_RESPONSE_CODE

protected static final String NON_HTTP_RESPONSE_CODE
See Also:
Constant Field Values

NON_HTTP_RESPONSE_MESSAGE

protected static final String NON_HTTP_RESPONSE_MESSAGE
See Also:
Constant Field Values

MAX_REDIRECTS

protected static final int MAX_REDIRECTS

MAX_FRAME_DEPTH

protected static final int MAX_FRAME_DEPTH

HEADER_AUTHORIZATION

protected static final String HEADER_AUTHORIZATION
See Also:
Constant Field Values

HEADER_COOKIE

protected static final String HEADER_COOKIE
See Also:
Constant Field Values

HEADER_CONNECTION

protected static final String HEADER_CONNECTION
See Also:
Constant Field Values

CONNECTION_CLOSE

protected static final String CONNECTION_CLOSE
See Also:
Constant Field Values

KEEP_ALIVE

protected static final String KEEP_ALIVE
See Also:
Constant Field Values

TRANSFER_ENCODING

protected static final String TRANSFER_ENCODING
See Also:
Constant Field Values

HEADER_CONTENT_ENCODING

protected static final String HEADER_CONTENT_ENCODING
See Also:
Constant Field Values

HTTP_1_1

protected static final String HTTP_1_1
See Also:
Constant Field Values

HEADER_SET_COOKIE

protected static final String HEADER_SET_COOKIE
See Also:
Constant Field Values

ENCODING_GZIP

protected static final String ENCODING_GZIP
See Also:
Constant Field Values

HEADER_CONTENT_DISPOSITION

protected static final String HEADER_CONTENT_DISPOSITION
See Also:
Constant Field Values

HEADER_CONTENT_TYPE

protected static final String HEADER_CONTENT_TYPE
See Also:
Constant Field Values

HEADER_CONTENT_LENGTH

protected static final String HEADER_CONTENT_LENGTH
See Also:
Constant Field Values

HEADER_LOCATION

protected static final String HEADER_LOCATION
See Also:
Constant Field Values

APPLICATION_X_WWW_FORM_URLENCODED

public static final String APPLICATION_X_WWW_FORM_URLENCODED
See Also:
Constant Field Values

MULTIPART_FORM_DATA

public static final String MULTIPART_FORM_DATA
See Also:
Constant Field Values
Constructor Detail

HTTPSamplerBase

public HTTPSamplerBase()
Method Detail

setFileField

public void setFileField(String value)
The name parameter to be applied to the file


getFileField

public String getFileField()
The name parameter to be applied to the file


setFilename

public void setFilename(String value)
The actual name of the file to POST


getFilename

public String getFilename()
The actual name of the file to POST


getSendFileAsPostBody

public boolean getSendFileAsPostBody()
Determine if the file should be sent as the entire Post body, i.e. without any additional wrapping

Returns:
true if specified file is to be sent as the body, i.e. FileField is blank

getSendParameterValuesAsPostBody

public boolean getSendParameterValuesAsPostBody()
Determine if none of the parameters have a name, and if that is the case, it means that the parameter values should be sent as the post body

Returns:
true if none of the parameters have a name specified

getUseMultipartForPost

public boolean getUseMultipartForPost()
Determine if we should use multipart/form-data or application/x-www-form-urlencoded for the post

Returns:
true if multipart/form-data should be used

setProtocol

public void setProtocol(String value)

getProtocol

public String getProtocol()

setPath

public void setPath(String path)
Sets the Path attribute of the UrlConfig object Also calls parseArguments to extract and store any query arguments

Parameters:
path - The new Path value

setPath

public void setPath(String path,
                    String contentEncoding)
Sets the Path attribute of the UrlConfig object Also calls parseArguments to extract and store any query arguments

Parameters:
path - The new Path value
contentEncoding - The encoding used for the querystring parameter values

getPath

public String getPath()

setFollowRedirects

public void setFollowRedirects(boolean value)

getFollowRedirects

public boolean getFollowRedirects()

setAutoRedirects

public void setAutoRedirects(boolean value)

getAutoRedirects

public boolean getAutoRedirects()

setMethod

public void setMethod(String value)

getMethod

public String getMethod()

setContentEncoding

public void setContentEncoding(String value)

getContentEncoding

public String getContentEncoding()

setUseKeepAlive

public void setUseKeepAlive(boolean value)

getUseKeepAlive

public boolean getUseKeepAlive()

setDoMultipartPost

public void setDoMultipartPost(boolean value)

getDoMultipartPost

public boolean getDoMultipartPost()

setMonitor

public void setMonitor(String value)

setMonitor

public void setMonitor(boolean truth)

getMonitor

public String getMonitor()

isMonitor

public boolean isMonitor()

setImplementation

public void setImplementation(String value)

getImplementation

public String getImplementation()

addEncodedArgument

public void addEncodedArgument(String name,
                               String value)
Add an argument which has already been encoded


addEncodedArgument

public void addEncodedArgument(String name,
                               String value,
                               String metaData,
                               String contentEncoding)

addEncodedArgument

public void addEncodedArgument(String name,
                               String value,
                               String metaData)

addNonEncodedArgument

public void addNonEncodedArgument(String name,
                                  String value,
                                  String metadata)

addArgument

public void addArgument(String name,
                        String value)

addArgument

public void addArgument(String name,
                        String value,
                        String metadata)

addTestElement

public void addTestElement(TestElement el)
Specified by:
addTestElement in interface TestElement
Overrides:
addTestElement in class AbstractTestElement

setPort

public void setPort(int value)

getDefaultPort

public static int getDefaultPort(String protocol,
                                 int port)

isProtocolDefaultPort

public boolean isProtocolDefaultPort()
Tell whether the default port for the specified protocol is used

Returns:
true if the default port number for the protocol is used, false otherwise

getPort

public int getPort()

setDomain

public void setDomain(String value)

getDomain

public String getDomain()

setArguments

public void setArguments(Arguments value)

getArguments

public Arguments getArguments()

setAuthManager

public void setAuthManager(AuthManager value)

getAuthManager

public AuthManager getAuthManager()

setHeaderManager

public void setHeaderManager(HeaderManager value)

getHeaderManager

public HeaderManager getHeaderManager()

setCookieManager

public void setCookieManager(CookieManager value)

getCookieManager

public CookieManager getCookieManager()

setMimetype

public void setMimetype(String value)

getMimetype

public String getMimetype()

isImageParser

public boolean isImageParser()

setImageParser

public void setImageParser(boolean parseImages)

getEmbeddedUrlRE

public String getEmbeddedUrlRE()
Get the regular expression URLs must match.

Returns:
regular expression (or empty) string

setEmbeddedUrlRE

public void setEmbeddedUrlRE(String regex)

errorResult

protected HTTPSampleResult errorResult(Throwable e,
                                       HTTPSampleResult res)
Obtain a result that will help inform the user that an error has occured during sampling, and how long it took to detect the error.

Parameters:
e - Exception representing the error.
Returns:
a sampling result useful to inform the user about the exception.

getUrl

public URL getUrl()
           throws MalformedURLException
Get the URL, built from its component parts.

Returns:
The URL to be requested by this sampler.
Throws:
MalformedURLException

getQueryString

public String getQueryString()
Gets the QueryString attribute of the UrlConfig object, using UTF-8 to encode the URL

Returns:
the QueryString value

getQueryString

public String getQueryString(String contentEncoding)
Gets the QueryString attribute of the UrlConfig object, using the specified encoding to encode the parameter values put into the URL

Parameters:
contentEncoding - the encoding to use for encoding parameter values
Returns:
the QueryString value

parseArguments

public void parseArguments(String queryString,
                           String contentEncoding)
This method allows a proxy server to send over the raw text from a browser's output stream to be parsed and stored correctly into the UrlConfig object. For each name found, addArgument() is called

Parameters:
queryString - - the query string
contentEncoding - - the content encoding of the query string. The query string might actually be the post body of a http post request.

parseArguments

public void parseArguments(String queryString)

toString

public String toString()

sample

public SampleResult sample(Entry e)
Do a sampling and return its results.

Specified by:
sample in interface Sampler
Parameters:
e - Entry to be sampled
Returns:
results of the sampling

sample

public SampleResult sample()
Perform a sample, and return the results

Returns:
results of the sampling

sample

protected abstract HTTPSampleResult sample(URL u,
                                           String method,
                                           boolean areFollowingRedirect,
                                           int depth)
Samples the URL passed in and stores the result in HTTPSampleResult, following redirects and downloading page resources as appropriate.

When getting a redirect target, redirects are not followed and resources are not downloaded. The caller will take care of this.

Parameters:
method - HTTP method: GET, POST,...
areFollowingRedirect - whether we're getting a redirect target
Returns:
results of the sampling

downloadPageResources

protected HTTPSampleResult downloadPageResources(HTTPSampleResult res,
                                                 HTTPSampleResult container,
                                                 int frameDepth)
Download the resources of an HTML page.

If createContainerResult is true, the returned result will contain one subsample for each request issued, including the original one that was passed in. It will otherwise look exactly like that original one.

If createContainerResult is false, one subsample will be added to the provided result for each requests issued.

Parameters:
res - result of the initial request - must contain an HTML response
container - for storing the results
frameDepth - Depth of this target in the frame structure. Used only to prevent infinite recursion.
Returns:
"Container" result with one subsample per request issued

encodeSpaces

protected String encodeSpaces(String path)

testEnded

public void testEnded()
Description copied from interface: TestListener
Called once for all threads after the end of a test.

Specified by:
testEnded in interface TestListener
See Also:
StandardJMeterEngine.stopTest()

testEnded

public void testEnded(String host)
Description copied from interface: TestListener
Called once for all threads after the end of a test.

Specified by:
testEnded in interface TestListener
See Also:
StandardJMeterEngine.stopTest()

testIterationStart

public void testIterationStart(LoopIterationEvent event)
Description copied from interface: TestListener
Each time through a Thread Group's test script, an iteration event is fired for each thread.

Specified by:
testIterationStart in interface TestListener
Parameters:
event -

testStarted

public void testStarted()
Description copied from interface: TestListener
Called just before the start of the test from the main engine thread. Note that not all the test variables will have been set up at this point.

Specified by:
testStarted in interface TestListener
See Also:
StandardJMeterEngine.run()

testStarted

public void testStarted(String host)
Description copied from interface: TestListener
Called just before the start of the test from the main engine thread. Note that not all the test variables will have been set up at this point.

Specified by:
testStarted in interface TestListener
See Also:
StandardJMeterEngine.run()

clone

public Object clone()
Specified by:
clone in interface TestElement
Overrides:
clone in class AbstractTestElement

followRedirects

protected HTTPSampleResult followRedirects(HTTPSampleResult res,
                                           int frameDepth)
Iteratively download the redirect targets of a redirect response.

The returned result will contain one subsample for each request issued, including the original one that was passed in. It will be an HTTPSampleResult that should mostly look as if the final destination of the redirect chain had been obtained in a single shot.

Parameters:
res - result of the initial request - must be a redirect response
frameDepth - Depth of this target in the frame structure. Used only to prevent infinite recursion.
Returns:
"Container" result with one subsample per request issued

resultProcessing

protected HTTPSampleResult resultProcessing(boolean areFollowingRedirect,
                                            int frameDepth,
                                            HTTPSampleResult res)
Follow redirects and download page resources if appropriate. this works, but the container stuff here is what's doing it. followRedirects() is actually doing the work to make sure we have only one container to make this work more naturally, I think this method - sample() - needs to take an HTTPSamplerResult container parameter instead of a boolean:areFollowingRedirect.

Parameters:
areFollowingRedirect -
frameDepth -
res -
Returns:

isSuccessCode

protected boolean isSuccessCode(int code)
Determine if the HTTP status code is successful or not i.e. in range 200 to 399 inclusive

Returns:
whether in range 200-399 or not

encodeBackSlashes

protected static String encodeBackSlashes(String value)

hasUploadableFiles

protected boolean hasUploadableFiles()
Method to tell if the request has any files to be uploaded


getValidMethodsAsArray

public static String[] getValidMethodsAsArray()

isSecure

public static boolean isSecure(String protocol)

isSecure

public static boolean isSecure(URL url)

threadStarted

public void threadStarted()
Description copied from interface: ThreadListener
Called just before the start of the thread

Specified by:
threadStarted in interface ThreadListener
See Also:
org.apache.jmeter.threads.JMeterThread#threadStarted()

threadFinished

public void threadFinished()
Description copied from interface: ThreadListener
Called once for each thread at the end of a test

Specified by:
threadFinished in interface ThreadListener
See Also:
org.apache.jmeter.threads.JMeterThread#threadFinished()

Apache JMeter

Copyright © 1998-2007 Apache Software Foundation. All Rights Reserved.