org.apache.jmeter.protocol.http.sampler

## Class HTTPSamplerBase

- java.lang.Object
- - org.apache.jmeter.testelement.AbstractTestElement
  - - org.apache.jmeter.samplers.AbstractSampler
    - - org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, ConfigMergabilityIndicator, Replaceable, Searchable, HTTPConstantsInterface, Sampler, TestElement, TestIterationListener, TestStateListener, ThreadListener
  Direct Known Subclasses:
    AjpSampler, HTTPSampler, HTTPSamplerProxy

      public abstract class HTTPSamplerBase
      extends AbstractSampler
      implements TestStateListener, TestIterationListener, ThreadListener, HTTPConstantsInterface, Replaceable

  Common constants and methods for HTTP samplers
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `HTTPSamplerBase.SourceType`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ARGUMENTS`
    `static java.lang.String` | `AUTH_MANAGER`
    `static java.lang.String` | `AUTO_REDIRECTS`
    `static java.lang.String` | `BROWSER_COMPATIBLE_MULTIPART`
    `static boolean` | `BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT`
    `static java.lang.String` | `CACHE_MANAGER`
    `static java.lang.String` | `CONCURRENT_DWN`
    `static java.lang.String` | `CONCURRENT_POOL`
    `static int` | `CONCURRENT_POOL_SIZE`
    `static java.lang.String` | `CONNECT_TIMEOUT`
    `static java.lang.String` | `CONTENT_ENCODING` This is the encoding used for the content, i.e. the charset name, not the header "Content-Encoding"
    `static java.lang.String` | `CONTENT_TYPE`
    `static java.lang.String` | `COOKIE_MANAGER`
    `static java.lang.String` | `DEFAULT_METHOD`
    `static java.lang.String` | `DNS_CACHE_MANAGER`
    `static java.lang.String` | `DO_MULTIPART_POST`
    `static java.lang.String` | `DOMAIN`
    `static java.lang.String` | `EMBEDDED_URL_RE`
    `static java.lang.String` | `FOLLOW_REDIRECTS`
    `static java.lang.String` | `HEADER_MANAGER`
    `static java.lang.String` | `IMAGE_PARSER`
    `static java.lang.String` | `IMPLEMENTATION`
    `static java.lang.String` | `IP_SOURCE` IP source to use - does not apply to Java HTTP implementation currently
    `static java.lang.String` | `IP_SOURCE_TYPE`
    `protected static int` | `MAX_FRAME_DEPTH`
    `protected static int` | `MAX_REDIRECTS`
    `static java.lang.String` | `MD5`
    `static java.lang.String` | `METHOD`
    `static java.lang.String` | `MONITOR`
    `protected static java.lang.String` | `NON_HTTP_RESPONSE_CODE`
    `protected static java.lang.String` | `NON_HTTP_RESPONSE_MESSAGE`
    `static java.lang.String` | `PATH`
    `static java.lang.String` | `PORT`
    `static java.lang.String` | `POST_BODY_RAW`
    `static boolean` | `POST_BODY_RAW_DEFAULT`
    `static java.lang.String` | `PROTOCOL`
    `static java.lang.String` | `PROXYHOST`
    `static java.lang.String` | `PROXYPASS`
    `static java.lang.String` | `PROXYPORT`
    `static java.lang.String` | `PROXYUSER`
    `static java.lang.String` | `RESPONSE_TIMEOUT`
    `static int` | `SOURCE_TYPE_DEFAULT`
    `static int` | `UNSPECIFIED_PORT` A number to indicate that the port has not been set.
    `static java.lang.String` | `UNSPECIFIED_PORT_AS_STRING`
    `static java.lang.String` | `URL`
    `static int` | `URL_UNSPECIFIED_PORT` If the port is not present in a URL, getPort() returns -1
    `static java.lang.String` | `URL_UNSPECIFIED_PORT_AS_STRING`
    `static java.lang.String` | `USE_KEEPALIVE`

    - ### Fields inherited from interface org.apache.jmeter.protocol.http.util.HTTPConstantsInterface

      `APPLICATION_X_WWW_FORM_URLENCODED, CACHE_CONTROL, CONNECT, CONNECTION_CLOSE, COPY, DATE, DEFAULT_HTTP_PORT, DEFAULT_HTTP_PORT_STRING, DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_PORT_STRING, DELETE, ENCODING_BROTLI, ENCODING_DEFLATE, ENCODING_GZIP, ETAG, EXPIRES, GET, HEAD, HEADER_AUTHORIZATION, HEADER_CONNECTION, HEADER_CONTENT_DISPOSITION, HEADER_CONTENT_ENCODING, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_COOKIE, HEADER_COOKIE_IN_REQUEST, HEADER_HOST, HEADER_LOCAL_ADDRESS, HEADER_LOCATION, HEADER_SET_COOKIE, HTTP_1_1, IF_MODIFIED_SINCE, IF_NONE_MATCH, KEEP_ALIVE, LAST_MODIFIED, LOCK, MKCALENDAR, MKCOL, MOVE, MULTIPART_FORM_DATA, OPTIONS, PATCH, POST, PROPFIND, PROPPATCH, PROTOCOL_HTTP, PROTOCOL_HTTPS, PUT, REPORT, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_SEE_OTHER, SC_TEMPORARY_REDIRECT, SEARCH, TRACE, TRANSFER_ENCODING, UNLOCK, VARY`

    - ### Fields inherited from interface org.apache.jmeter.testelement.TestElement

      `COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HTTPSamplerBase()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addArgument(java.lang.String name, java.lang.String value)`
    `void` | `addArgument(java.lang.String name, java.lang.String value, java.lang.String metadata)`
    `void` | `addEncodedArgument(java.lang.String name, java.lang.String value)` Add an argument which has already been encoded
    `void` | `addEncodedArgument(java.lang.String name, java.lang.String value, java.lang.String metaData)`
    `void` | `addEncodedArgument(java.lang.String name, java.lang.String value, java.lang.String metaData, java.lang.String contentEncoding)` Creates an HTTPArgument and adds it to the current set `getArguments()` of arguments.
    `void` | `addNonEncodedArgument(java.lang.String name, java.lang.String value, java.lang.String metadata)`
    `void` | `addTestElement(TestElement el)`
    `boolean` | `applies(ConfigTestElement configElement)` Does configElement apply to Sampler
    `void` | `clearTestElementChildren()` This method should clear any test element properties that are merged by `TestElement.addTestElement(TestElement)`.
    `protected HTTPSampleResult` | `downloadPageResources(HTTPSampleResult pRes, HTTPSampleResult container, int frameDepth)` Download the resources of an HTML page.
    `protected static java.lang.String` | `encodeBackSlashes(java.lang.String value)`
    `protected java.lang.String` | `encodeSpaces(java.lang.String path)`
    `protected HTTPSampleResult` | `errorResult(java.lang.Throwable e, HTTPSampleResult res)` Populates the provided HTTPSampleResult with details from the Exception.
    `protected HTTPSampleResult` | `followRedirects(HTTPSampleResult res, int frameDepth)` Iteratively download the redirect targets of a redirect response.
    `Arguments` | `getArguments()`
    `AuthManager` | `getAuthManager()`
    `boolean` | `getAutoRedirects()`
    `CacheManager` | `getCacheManager()`
    `java.lang.String` | `getConcurrentPool()` Get the pool size for concurrent thread pool to get embedded resources.
    `int` | `getConnectTimeout()`
    `java.lang.String` | `getContentEncoding()`
    `CookieManager` | `getCookieManager()`
    `static int` | `getDefaultPort(java.lang.String protocol, int port)` Get the port number for a URL, applying defaults if necessary.
    `DNSCacheManager` | `getDNSResolver()`
    `boolean` | `getDoBrowserCompatibleMultipart()`
    `java.lang.String` | `getDomain()`
    `boolean` | `getDoMultipartPost()`
    `java.lang.String` | `getEmbeddedUrlRE()` Get the regular expression URLs must match.
    `boolean` | `getFollowRedirects()`
    `HeaderManager` | `getHeaderManager()`
    `int` | `getHTTPFileCount()`
    `HTTPFileArg[]` | `getHTTPFiles()` Get the collection of files as a list.
    `java.lang.String` | `getImplementation()`
    `java.lang.String` | `getIpSource()` get IP source to use - does not apply to Java HTTP implementation currently
    `int` | `getIpSourceType()` get IP/address source type to use
    `java.lang.String` | `getMethod()`
    `java.lang.String` | `getMonitor()` Deprecated. since 3.2 always returns false
    `java.lang.String` | `getPath()`
    `int` | `getPort()` Get the port; apply the default for the protocol if necessary.
    `int` | `getPortIfSpecified()` Get the port number from the port string, allowing for trailing blanks.
    `boolean` | `getPostBodyRaw()`
    `java.lang.String` | `getProtocol()` Gets the protocol, with default.
    `java.lang.String` | `getProxyHost()`
    `java.lang.String` | `getProxyPass()`
    `int` | `getProxyPortInt()`
    `java.lang.String` | `getProxyUser()`
    `java.lang.String` | `getQueryString()` Gets the QueryString attribute of the UrlConfig object, using UTF-8 to encode the URL
    `java.lang.String` | `getQueryString(java.lang.String contentEncoding)` Gets the QueryString attribute of the UrlConfig object, using the specified encoding to encode the parameter values put into the URL
    `int` | `getResponseTimeout()`
    `boolean` | `getSendFileAsPostBody()` Determine if the file should be sent as the entire Content 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 entity body
    `static java.lang.String[]` | `getSourceTypeList()`
    `java.net.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 java.lang.String[]` | `getValidMethodsAsArray()`
    `boolean` | `hasArguments()`
    `boolean` | `isConcurrentDwn()` Return if used a concurrent thread pool to get embedded resources.
    `boolean` | `isImageParser()`
    `boolean` | `isMonitor()` Deprecated. since 3.2 always returns false
    `boolean` | `isProtocolDefaultPort()` Tell whether the default port for the specified protocol is used
    `static boolean` | `isSecure(java.lang.String protocol)`
    `static boolean` | `isSecure(java.net.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(java.lang.String queryString)`
    `void` | `parseArguments(java.lang.String queryString, java.lang.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.
    `byte[]` | `readResponse(SampleResult sampleResult, java.io.InputStream in, long length)` Read response from the input stream, converting to MD5 digest if the useMD5 property is set.
    `int` | `replace(java.lang.String regex, java.lang.String replaceBy, boolean caseSensitive)` Replace by replaceBy in path and body (arguments) properties
    `protected HTTPSampleResult` | `resultProcessing(boolean pAreFollowingRedirect, int frameDepth, HTTPSampleResult pRes)` 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(java.net.URL u, java.lang.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` | `setCacheManager(CacheManager value)`
    `void` | `setConcurrentDwn(boolean concurrentDwn)`
    `void` | `setConcurrentPool(java.lang.String poolSize)`
    `void` | `setConnectTimeout(java.lang.String value)`
    `void` | `setContentEncoding(java.lang.String charsetName)` Sets the value of the encoding to be used for the content.
    `void` | `setCookieManager(CookieManager value)`
    `void` | `setDNSResolver(DNSCacheManager cacheManager)`
    `void` | `setDoBrowserCompatibleMultipart(boolean value)`
    `void` | `setDomain(java.lang.String value)`
    `void` | `setDoMultipartPost(boolean value)`
    `void` | `setEmbeddedUrlRE(java.lang.String regex)`
    `void` | `setFollowRedirects(boolean value)`
    `void` | `setHeaderManager(HeaderManager value)`
    `void` | `setHTTPFiles(HTTPFileArg[] files)` Saves the list of files.
    `void` | `setImageParser(boolean parseImages)`
    `void` | `setImplementation(java.lang.String value)`
    `void` | `setIpSource(java.lang.String value)` set IP source to use - does not apply to Java HTTP implementation currently
    `void` | `setIpSourceType(int value)` set IP/address source type to use
    `void` | `setMD5(boolean truth)`
    `void` | `setMethod(java.lang.String value)`
    `void` | `setMonitor(boolean truth)`
    `void` | `setMonitor(java.lang.String value)`
    `void` | `setPath(java.lang.String path)` Sets the Path attribute of the UrlConfig object Also calls parseArguments to extract and store any query arguments
    `void` | `setPath(java.lang.String path, java.lang.String contentEncoding)` Sets the PATH property; if the request is a GET or DELETE (and the path does not start with http[s]://) it also calls `parseArguments(String, String)` to extract and store any query arguments.
    `void` | `setPort(int value)`
    `void` | `setPostBodyRaw(boolean value)`
    `void` | `setProtocol(java.lang.String value)`
    `void` | `setResponseTimeout(java.lang.String value)`
    `void` | `setUseKeepAlive(boolean value)`
    `void` | `testEnded()` Called once for all threads after the end of a test.
    `void` | `testEnded(java.lang.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(java.lang.String host)` Called just before the start of the test from the main engine thread.
    `void` | `threadFinished()` Called for each thread after all samples have been processed.
    `void` | `threadStarted()` Called for each thread before starting sampling.
    `java.lang.String` | `toString()`
    `boolean` | `useMD5()`

    - ### Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement

      `addPropertiesValues, addProperty, addProperty, canRemove, clear, clearTemporary, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, 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, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removed, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse`

- - ### Field Detail

    - #### ARGUMENTS

          public static final java.lang.String ARGUMENTS

      See Also:
        Constant Field Values

    - #### AUTH_MANAGER

          public static final java.lang.String AUTH_MANAGER

      See Also:
        Constant Field Values

    - #### COOKIE_MANAGER

          public static final java.lang.String COOKIE_MANAGER

      See Also:
        Constant Field Values

    - #### CACHE_MANAGER

          public static final java.lang.String CACHE_MANAGER

      See Also:
        Constant Field Values

    - #### HEADER_MANAGER

          public static final java.lang.String HEADER_MANAGER

      See Also:
        Constant Field Values

    - #### DNS_CACHE_MANAGER

          public static final java.lang.String DNS_CACHE_MANAGER

      See Also:
        Constant Field Values

    - #### DOMAIN

          public static final java.lang.String DOMAIN

      See Also:
        Constant Field Values

    - #### PORT

          public static final java.lang.String PORT

      See Also:
        Constant Field Values

    - #### PROXYHOST

          public static final java.lang.String PROXYHOST

      See Also:
        Constant Field Values

    - #### PROXYPORT

          public static final java.lang.String PROXYPORT

      See Also:
        Constant Field Values

    - #### PROXYUSER

          public static final java.lang.String PROXYUSER

      See Also:
        Constant Field Values

    - #### PROXYPASS

          public static final java.lang.String PROXYPASS

      See Also:
        Constant Field Values

    - #### CONNECT_TIMEOUT

          public static final java.lang.String CONNECT_TIMEOUT

      See Also:
        Constant Field Values

    - #### RESPONSE_TIMEOUT

          public static final java.lang.String RESPONSE_TIMEOUT

      See Also:
        Constant Field Values

    - #### METHOD

          public static final java.lang.String METHOD

      See Also:
        Constant Field Values

    - #### CONTENT_ENCODING

          public static final java.lang.String CONTENT_ENCODING

      This is the encoding used for the content, i.e. the charset name, not the header "Content-Encoding"
      See Also:
        Constant Field Values

    - #### IMPLEMENTATION

          public static final java.lang.String IMPLEMENTATION

      See Also:
        Constant Field Values

    - #### PATH

          public static final java.lang.String PATH

      See Also:
        Constant Field Values

    - #### FOLLOW_REDIRECTS

          public static final java.lang.String FOLLOW_REDIRECTS

      See Also:
        Constant Field Values

    - #### AUTO_REDIRECTS

          public static final java.lang.String AUTO_REDIRECTS

      See Also:
        Constant Field Values

    - #### PROTOCOL

          public static final java.lang.String PROTOCOL

      See Also:
        Constant Field Values

    - #### URL

          public static final java.lang.String URL

      See Also:
        Constant Field Values

    - #### IP_SOURCE

          public static final java.lang.String IP_SOURCE

      IP source to use - does not apply to Java HTTP implementation currently
      See Also:
        Constant Field Values

    - #### IP_SOURCE_TYPE

          public static final java.lang.String IP_SOURCE_TYPE

      See Also:
        Constant Field Values

    - #### USE_KEEPALIVE

          public static final java.lang.String USE_KEEPALIVE

      See Also:
        Constant Field Values

    - #### DO_MULTIPART_POST

          public static final java.lang.String DO_MULTIPART_POST

      See Also:
        Constant Field Values

    - #### BROWSER_COMPATIBLE_MULTIPART

          public static final java.lang.String BROWSER_COMPATIBLE_MULTIPART

      See Also:
        Constant Field Values

    - #### CONCURRENT_DWN

          public static final java.lang.String CONCURRENT_DWN

      See Also:
        Constant Field Values

    - #### CONCURRENT_POOL

          public static final java.lang.String CONCURRENT_POOL

      See Also:
        Constant Field Values

    - #### CONCURRENT_POOL_SIZE

          public static final int CONCURRENT_POOL_SIZE

      See Also:
        Constant Field Values

    - #### BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT

          public static final boolean BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT

      See Also:
        Constant Field Values

    - #### SOURCE_TYPE_DEFAULT

          public static final int SOURCE_TYPE_DEFAULT

    - #### DEFAULT_METHOD

          public static final java.lang.String DEFAULT_METHOD

      See Also:
        Constant Field Values

    - #### CONTENT_TYPE

          public static final java.lang.String CONTENT_TYPE

      See Also:
        Constant Field Values

    - #### IMAGE_PARSER

          public static final java.lang.String IMAGE_PARSER

      See Also:
        Constant Field Values

    - #### EMBEDDED_URL_RE

          public static final java.lang.String EMBEDDED_URL_RE

      See Also:
        Constant Field Values

    - #### MONITOR

          public static final java.lang.String MONITOR

      See Also:
        Constant Field Values

    - #### MD5

          public static final java.lang.String MD5

      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 java.lang.String UNSPECIFIED_PORT_AS_STRING

      See Also:
        Constant Field Values

    - #### URL_UNSPECIFIED_PORT

          public static final int URL_UNSPECIFIED_PORT

      If the port is not present in a URL, getPort() returns -1
      See Also:
        Constant Field Values

    - #### URL_UNSPECIFIED_PORT_AS_STRING

          public static final java.lang.String URL_UNSPECIFIED_PORT_AS_STRING

      See Also:
        Constant Field Values

    - #### NON_HTTP_RESPONSE_CODE

          protected static final java.lang.String NON_HTTP_RESPONSE_CODE

      See Also:
        Constant Field Values

    - #### NON_HTTP_RESPONSE_MESSAGE

          protected static final java.lang.String NON_HTTP_RESPONSE_MESSAGE

      See Also:
        Constant Field Values

    - #### POST_BODY_RAW

          public static final java.lang.String POST_BODY_RAW

      See Also:
        Constant Field Values

    - #### POST_BODY_RAW_DEFAULT

          public static final boolean POST_BODY_RAW_DEFAULT

      See Also:
        Constant Field Values

    - #### MAX_REDIRECTS

          protected static final int MAX_REDIRECTS

    - #### MAX_FRAME_DEPTH

          protected static final int MAX_FRAME_DEPTH

  - ### Constructor Detail

    - #### HTTPSamplerBase

          public HTTPSamplerBase()

  - ### Method Detail

    - #### getSourceTypeList

          public static java.lang.String[] getSourceTypeList()

    - #### getSendFileAsPostBody

          public boolean getSendFileAsPostBody()

      Determine if the file should be sent as the entire Content body, i.e. without any additional wrapping.
      Returns:
        true if specified file is to be sent as the body, i.e. there is a single file entry which has a non-empty path and an empty Parameter name.

    - #### 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 entity body
      Returns:
        `true` if there are parameters and none of these have a name specified, or `getPostBodyRaw()` returns `true`

    - #### 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 and method is POST

    - #### setProtocol

          public void setProtocol(java.lang.String value)

    - #### getProtocol

          public java.lang.String getProtocol()

      Gets the protocol, with default.
      Returns:
        the protocol

    - #### setPath

          public void setPath(java.lang.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(java.lang.String path,
                              java.lang.String contentEncoding)

      Sets the PATH property; if the request is a GET or DELETE (and the path does not start with http[s]://) it also calls `parseArguments(String, String)` to extract and store any query arguments.
      Parameters:
        `path` - The new Path value
        `contentEncoding` - The encoding used for the querystring parameter values

    - #### getPath

          public java.lang.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(java.lang.String value)

    - #### getMethod

          public java.lang.String getMethod()

    - #### setContentEncoding

          public void setContentEncoding(java.lang.String charsetName)

      Sets the value of the encoding to be used for the content.
      Parameters:
        `charsetName` - the name of the encoding to be used

    - #### getContentEncoding

          public java.lang.String getContentEncoding()

      Returns:
        the encoding of the content, i.e. its charset name

    - #### setUseKeepAlive

          public void setUseKeepAlive(boolean value)

    - #### getUseKeepAlive

          public boolean getUseKeepAlive()

    - #### setDoMultipartPost

          public void setDoMultipartPost(boolean value)

    - #### getDoMultipartPost

          public boolean getDoMultipartPost()

    - #### setDoBrowserCompatibleMultipart

          public void setDoBrowserCompatibleMultipart(boolean value)

    - #### getDoBrowserCompatibleMultipart

          public boolean getDoBrowserCompatibleMultipart()

    - #### setMonitor

          public void setMonitor(java.lang.String value)

    - #### setMonitor

          public void setMonitor(boolean truth)

    - #### getMonitor

          @Deprecated
          public java.lang.String getMonitor()

      Deprecated. since 3.2 always returns false
      Returns:
        boolean

    - #### isMonitor

          @Deprecated
          public boolean isMonitor()

      Deprecated. since 3.2 always returns false
      Returns:
        boolean

    - #### setImplementation

          public void setImplementation(java.lang.String value)

    - #### getImplementation

          public java.lang.String getImplementation()

    - #### useMD5

          public boolean useMD5()

    - #### setMD5

          public void setMD5(boolean truth)

    - #### addEncodedArgument

          public void addEncodedArgument(java.lang.String name,
                                         java.lang.String value)

      Add an argument which has already been encoded
      Parameters:
        `name` - name of the argument
        `value` - value of the argument

    - #### addEncodedArgument

          public void addEncodedArgument(java.lang.String name,
                                         java.lang.String value,
                                         java.lang.String metaData,
                                         java.lang.String contentEncoding)

      Creates an HTTPArgument and adds it to the current set `getArguments()` of arguments.
      Parameters:
        `name` - - the parameter name
        `value` - - the parameter value
        `metaData` - - normally just '='
        `contentEncoding` - - the encoding, may be null

    - #### addEncodedArgument

          public void addEncodedArgument(java.lang.String name,
                                         java.lang.String value,
                                         java.lang.String metaData)

    - #### addNonEncodedArgument

          public void addNonEncodedArgument(java.lang.String name,
                                            java.lang.String value,
                                            java.lang.String metadata)

    - #### addArgument

          public void addArgument(java.lang.String name,
                                  java.lang.String value)

    - #### addArgument

          public void addArgument(java.lang.String name,
                                  java.lang.String value,
                                  java.lang.String metadata)

    - #### hasArguments

          public boolean hasArguments()

    - #### addTestElement

          public void addTestElement(TestElement el)

      Description copied from class: `AbstractTestElement`
      Specified by:
        `addTestElement` in interface `TestElement`
      Overrides:
        `addTestElement` in class `AbstractTestElement`

    - #### clearTestElementChildren

          public void clearTestElementChildren()

      This method should clear any test element properties that are merged by `TestElement.addTestElement(TestElement)`.

      Default implementation - does nothing

      Clears the Header Manager property so subsequent loops don't keep merging more elements

      Specified by:
        `clearTestElementChildren` in interface `TestElement`
      Overrides:
        `clearTestElementChildren` in class `AbstractTestElement`

    - #### setPort

          public void setPort(int value)

    - #### getDefaultPort

          public static int getDefaultPort(java.lang.String protocol,
                                           int port)

      Get the port number for a URL, applying defaults if necessary. (Called by CookieManager.)
      Parameters:
        `protocol` - from `URL.getProtocol()`
        `port` - number from `URL.getPort()`
      Returns:
        the default port for the protocol

    - #### getPortIfSpecified

          public int getPortIfSpecified()

      Get the port number from the port string, allowing for trailing blanks.
      Returns:
        port number or UNSPECIFIED_PORT (== 0)

    - #### 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()

      Get the port; apply the default for the protocol if necessary.
      Returns:
        the port number, with default applied if required.

    - #### setDomain

          public void setDomain(java.lang.String value)

    - #### getDomain

          public java.lang.String getDomain()

    - #### setConnectTimeout

          public void setConnectTimeout(java.lang.String value)

    - #### getConnectTimeout

          public int getConnectTimeout()

    - #### setResponseTimeout

          public void setResponseTimeout(java.lang.String value)

    - #### getResponseTimeout

          public int getResponseTimeout()

    - #### getProxyHost

          public java.lang.String getProxyHost()

    - #### getProxyPortInt

          public int getProxyPortInt()

    - #### getProxyUser

          public java.lang.String getProxyUser()

    - #### getProxyPass

          public java.lang.String getProxyPass()

    - #### setArguments

          public final void setArguments(Arguments value)

    - #### getArguments

          public Arguments getArguments()

    - #### setPostBodyRaw

          public void setPostBodyRaw(boolean value)

      Parameters:
        `value` - Boolean that indicates body will be sent as is

    - #### getPostBodyRaw

          public boolean getPostBodyRaw()

      Returns:
        boolean that indicates body will be sent as is

    - #### 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()

    - #### setCacheManager

          public void setCacheManager(CacheManager value)

    - #### getCacheManager

          public CacheManager getCacheManager()

    - #### getDNSResolver

          public DNSCacheManager getDNSResolver()

    - #### setDNSResolver

          public void setDNSResolver(DNSCacheManager cacheManager)

    - #### isImageParser

          public boolean isImageParser()

    - #### setImageParser

          public void setImageParser(boolean parseImages)

    - #### getEmbeddedUrlRE

          public java.lang.String getEmbeddedUrlRE()

      Get the regular expression URLs must match.
      Returns:
        regular expression (or empty) string

    - #### setEmbeddedUrlRE

          public void setEmbeddedUrlRE(java.lang.String regex)

    - #### errorResult

          protected HTTPSampleResult errorResult(java.lang.Throwable e,
                                                 HTTPSampleResult res)

      Populates the provided HTTPSampleResult with details from the Exception. Does not create a new instance, so should not be used directly to add a subsample.
      Parameters:
        `e` - Exception representing the error.
        `res` - SampleResult to be modified
      Returns:
        the modified sampling result containing details of the Exception.

    - #### getUrl

          public java.net.URL getUrl()
                              throws java.net.MalformedURLException

      Get the URL, built from its component parts.

      As a special case, if the path starts with "http[s]://", then the path is assumed to be the entire URL.

      Returns:
        The URL to be requested by this sampler.
      Throws:
        `java.net.MalformedURLException` - if url is malformed

    - #### getQueryString

          public java.lang.String getQueryString()

      Gets the QueryString attribute of the UrlConfig object, using UTF-8 to encode the URL
      Returns:
        the QueryString value

    - #### getQueryString

          public java.lang.String getQueryString(java.lang.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(java.lang.String queryString,
                                     java.lang.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, might be the post body of a http post request.
        `contentEncoding` - - the content encoding of the query string; if non-null then it is used to decode the

    - #### parseArguments

          public void parseArguments(java.lang.String queryString)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### 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(java.net.URL u,
                                                     java.lang.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:
        `u` - URL to sample
        `method` - HTTP method: GET, POST,...
        `areFollowingRedirect` - whether we're getting a redirect target
        `depth` - Depth of this target in the frame structure. Used only to prevent infinite recursion.
      Returns:
        results of the sampling, can be null if u is in CacheManager

    - #### downloadPageResources

          protected HTTPSampleResult downloadPageResources(HTTPSampleResult pRes,
                                                           HTTPSampleResult container,
                                                           int frameDepth)

      Download the resources of an HTML page.
      Parameters:
        `pRes` - result of the initial request - must contain an HTML response
        `container` - for storing the results, if any
        `frameDepth` - Depth of this target in the frame structure. Used only to prevent infinite recursion.
      Returns:
        res if no resources exist, otherwise the "Container" result with one subsample per request issued

    - #### encodeSpaces

          protected java.lang.String encodeSpaces(java.lang.String path)

    - #### testEnded

          public void testEnded()

      Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

      N.B. testStarted() and testEnded() are called from different threads.

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

    - #### testEnded

          public void testEnded(java.lang.String host)

      Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testEnded` in interface `TestStateListener`
      Parameters:
        `host` - name of host
      See Also:
        `StandardJMeterEngine.stopTest()`

    - #### testStarted

          public void testStarted()

      Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

      N.B. testStarted() and testEnded() are called from different threads.

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

    - #### testStarted

          public void testStarted(java.lang.String host)

      Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

      N.B. testStarted() and testEnded() are called from different threads.

      Specified by:
        `testStarted` in interface `TestStateListener`
      Parameters:
        `host` - name of host
      See Also:
        `StandardJMeterEngine.run()`

    - #### 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 pAreFollowingRedirect,
                                                      int frameDepth,
                                                      HTTPSampleResult pRes)

      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:
        `pAreFollowingRedirect` - flag whether we are getting a redirect target
        `frameDepth` - Depth of this target in the frame structure. Used only to prevent infinite recursion.
        `pRes` - sample result to process
      Returns:
        the sample result

    - #### isSuccessCode

          protected boolean isSuccessCode(int code)

      Determine if the HTTP status code is successful or not i.e. in range 200 to 399 inclusive
      Parameters:
        `code` - status code to check
      Returns:
        whether in range 200-399 or not

    - #### encodeBackSlashes

          protected static java.lang.String encodeBackSlashes(java.lang.String value)

    - #### getHTTPFiles

          public HTTPFileArg[] getHTTPFiles()

      Get the collection of files as a list. The list is built up from the filename/filefield/mimetype properties, plus any additional entries saved in the FILE_ARGS property. If there are no valid file entries, then an empty list is returned.
      Returns:
        an array of file arguments (never null)

    - #### getHTTPFileCount

          public int getHTTPFileCount()

    - #### setHTTPFiles

          public void setHTTPFiles(HTTPFileArg[] files)

      Saves the list of files. The first file is saved in the Filename/field/mimetype properties. Any additional files are saved in the FILE_ARGS array.
      Parameters:
        `files` - list of files to save

    - #### getValidMethodsAsArray

          public static java.lang.String[] getValidMethodsAsArray()

    - #### isSecure

          public static boolean isSecure(java.lang.String protocol)

    - #### isSecure

          public static boolean isSecure(java.net.URL url)

    - #### threadStarted

          public void threadStarted()

      Description copied from interface: `ThreadListener`
      Called for each thread before starting sampling. WARNING: this is called before any Config test elements are processed, so any properties they define will not have been merged in yet.
      Specified by:
        `threadStarted` in interface `ThreadListener`
      See Also:
        `JMeterThread.threadStarted()`

    - #### threadFinished

          public void threadFinished()

      Description copied from interface: `ThreadListener`
      Called for each thread after all samples have been processed.
      Specified by:
        `threadFinished` in interface `ThreadListener`
      See Also:
        `JMeterThread.threadFinished(org.apache.jmeter.engine.event.LoopIterationListener)`

    - #### testIterationStart

          public void testIterationStart(LoopIterationEvent event)

      Description copied from interface: `TestIterationListener`
      Each time through a Thread Group's test script, an iteration event is fired for each thread. This will be after the test elements have been cloned, so in general the instance will not be the same as the ones the start/end methods call.
      Specified by:
        `testIterationStart` in interface `TestIterationListener`
      Parameters:
        `event` - the iteration event

    - #### readResponse

          public byte[] readResponse(SampleResult sampleResult,
                                     java.io.InputStream in,
                                     long length)
                              throws java.io.IOException

      Read response from the input stream, converting to MD5 digest if the useMD5 property is set.

      For the MD5 case, the result byte count is set to the size of the original response.

      Closes the inputStream

      Parameters:
        `sampleResult` - sample to store information about the response into
        `in` - input stream from which to read the response
        `length` - expected input length or zero
      Returns:
        the response or the MD5 of the response
      Throws:
        `java.io.IOException` - if reading the result fails

    - #### setIpSource

          public void setIpSource(java.lang.String value)

      set IP source to use - does not apply to Java HTTP implementation currently
      Parameters:
        `value` - IP source to use

    - #### getIpSource

          public java.lang.String getIpSource()

      get IP source to use - does not apply to Java HTTP implementation currently
      Returns:
        IP source to use

    - #### setIpSourceType

          public void setIpSourceType(int value)

      set IP/address source type to use
      Parameters:
        `value` - type of the IP/address source

    - #### getIpSourceType

          public int getIpSourceType()

      get IP/address source type to use
      Returns:
        address source type

    - #### isConcurrentDwn

          public boolean isConcurrentDwn()

      Return if used a concurrent thread pool to get embedded resources.
      Returns:
        true if used

    - #### setConcurrentDwn

          public void setConcurrentDwn(boolean concurrentDwn)

    - #### getConcurrentPool

          public java.lang.String getConcurrentPool()

      Get the pool size for concurrent thread pool to get embedded resources.
      Returns:
        the pool size

    - #### setConcurrentPool

          public void setConcurrentPool(java.lang.String poolSize)

    - #### applies

          public boolean applies(ConfigTestElement configElement)

      Description copied from class: `AbstractSampler`
      Does configElement apply to Sampler
      Specified by:
        `applies` in interface `ConfigMergabilityIndicator`
      Overrides:
        `applies` in class `AbstractSampler`
      Parameters:
        `configElement` - `ConfigTestElement`
      Returns:
        boolean
      See Also:
        `AbstractSampler.applies(org.apache.jmeter.config.ConfigTestElement)`

    - #### replace

          public int replace(java.lang.String regex,
                             java.lang.String replaceBy,
                             boolean caseSensitive)
                      throws java.lang.Exception

      Replace by replaceBy in path and body (arguments) properties
      Specified by:
        `replace` in interface `Replaceable`
      Parameters:
        `regex` - Regular expression to search for
        `replaceBy` - Text used as replacement
        `caseSensitive` - flag, whether search should be done case sensitive
      Returns:
        number of replacements
      Throws:
        `java.lang.Exception` - when something fails while replacing

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