org.apache.jmeter.protocol.http.sampler

## Class HTTPSampleResult

- java.lang.Object
- - org.apache.jmeter.samplers.SampleResult
  - - org.apache.jmeter.protocol.http.sampler.HTTPSampleResult

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Searchable

      public class HTTPSampleResult
      extends SampleResult

  This is a specialisation of the SampleResult class for the HTTP protocol.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.jmeter.samplers.SampleResult

      `BINARY, DEFAULT_ENCODING, DEFAULT_HTTP_ENCODING, TEXT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HTTPSampleResult()`
    `HTTPSampleResult(HTTPSampleResult res)` Construct a 'parent' result for an already-existing result, essentially cloning it
    `HTTPSampleResult(long elapsed)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getCookies()`
    `java.lang.String` | `getDataEncodingNoDefault()` Overrides the method from SampleResult - so the encoding can be extracted from the Meta content-type if necessary.
    `java.lang.String` | `getDataEncodingWithDefault(java.lang.String defaultEncoding)` Overrides the method from SampleResult - so the encoding can be extracted from the Meta content-type if necessary.
    `java.lang.String` | `getHTTPMethod()`
    `java.lang.String` | `getQueryString()` Fetch the query string
    `java.lang.String` | `getRedirectLocation()`
    `java.lang.String` | `getSamplerData()` Overrides version in Sampler data to provide more details
    `java.util.List<java.lang.String>` | `getSearchableTokens()` Get a list of all tokens that should be visible to searching
    `boolean` | `isRedirect()` Determine whether this result is a redirect.
    `void` | `setCookies(java.lang.String string)`
    `void` | `setHTTPMethod(java.lang.String method)`
    `void` | `setQueryString(java.lang.String string)` Save the query string
    `void` | `setRedirectLocation(java.lang.String redirectLocation)`
    `void` | `setResponseNoContent()`

    - ### Methods inherited from class org.apache.jmeter.samplers.SampleResult

      `addAssertionResult, addRawSubResult, addSubResult, cleanAfterSample, clone, connectEnd, createTestSample, createTestSample, currentTimeInMillis, getAllThreads, getAssertionResults, getBodySize, getBodySizeAsLong, getBytes, getBytesAsLong, getConnectTime, getContentType, getDataEncodingWithDefault, getDataType, getEndTime, getErrorCount, getGroupThreads, getHeadersSize, getIdleTime, getLatency, getMediaType, getParent, getRequestHeaders, getResponseCode, getResponseData, getResponseDataAsString, getResponseHeaders, getResponseMessage, getResultFileName, getSampleCount, getSampleLabel, getSampleLabel, getSaveConfig, getSentBytes, getStartTime, getSubResults, getThreadName, getTime, getTimeStamp, getURL, getUrlAsString, isIgnore, isMonitor, isResponseCodeOK, isStampedAtStart, isStartNextThreadLoop, isStopTest, isStopTestNow, isStopThread, isSuccessful, latencyEnd, markFile, removeAssertionResults, removeSubResults, sampleEnd, samplePause, sampleResume, sampleStart, setAllThreads, setBodySize, setBodySize, setBytes, setBytes, setConnectTime, setContentType, setDataEncoding, setDataType, setEncodingAndType, setEndTime, setErrorCount, setGroupThreads, setHeadersSize, setIdleTime, setIgnore, setLatency, setMonitor, setParent, setRequestHeaders, setResponseCode, setResponseCodeOK, setResponseData, setResponseData, setResponseData, setResponseHeaders, setResponseMessage, setResponseMessageOK, setResponseOK, setResultFileName, setSampleCount, setSampleLabel, setSamplerData, setSaveConfig, setSentBytes, setStampAndTime, setStartNextThreadLoop, setStartTime, setStopTest, setStopTestNow, setStopThread, setSuccessful, setThreadName, setTimeStamp, setURL, storeSubResult, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### HTTPSampleResult

          public HTTPSampleResult()

    - #### HTTPSampleResult

          public HTTPSampleResult(long elapsed)

    - #### HTTPSampleResult

          public HTTPSampleResult(HTTPSampleResult res)

      Construct a 'parent' result for an already-existing result, essentially cloning it
      Parameters:
        `res` - existing sample result

  - ### Method Detail

    - #### setHTTPMethod

          public void setHTTPMethod(java.lang.String method)

    - #### getHTTPMethod

          public java.lang.String getHTTPMethod()

    - #### setRedirectLocation

          public void setRedirectLocation(java.lang.String redirectLocation)

    - #### getRedirectLocation

          public java.lang.String getRedirectLocation()

    - #### isRedirect

          public boolean isRedirect()

      Determine whether this result is a redirect. Returns true for: 301,302,303 and 307(GET or HEAD)
      Returns:
        true iff res is an HTTP redirect response

    - #### getSamplerData

          public java.lang.String getSamplerData()

      Overrides version in Sampler data to provide more details

      Overrides:
        `getSamplerData` in class `SampleResult`

    - #### getCookies

          public java.lang.String getCookies()

      Returns:
        cookies as a string

    - #### setCookies

          public void setCookies(java.lang.String string)

      Parameters:
        `string` - representing the cookies

    - #### getQueryString

          public java.lang.String getQueryString()

      Fetch the query string
      Returns:
        the query string

    - #### setQueryString

          public void setQueryString(java.lang.String string)

      Save the query string
      Parameters:
        `string` - the query string

    - #### getDataEncodingWithDefault

          public java.lang.String getDataEncodingWithDefault(java.lang.String defaultEncoding)

      Overrides the method from SampleResult - so the encoding can be extracted from the Meta content-type if necessary. Updates the dataEncoding field if the content-type is found.
      Overrides:
        `getDataEncodingWithDefault` in class `SampleResult`
      Parameters:
        `defaultEncoding` - Default encoding used if there is no data encoding
      Returns:
        the dataEncoding value as a String

    - #### getDataEncodingNoDefault

          public java.lang.String getDataEncodingNoDefault()

      Overrides the method from SampleResult - so the encoding can be extracted from the Meta content-type if necessary. Updates the dataEncoding field if the content-type is found.
      Overrides:
        `getDataEncodingNoDefault` in class `SampleResult`
      Returns:
        the dataEncoding value as a String

    - #### setResponseNoContent

          public void setResponseNoContent()

    - #### getSearchableTokens

          public java.util.List<java.lang.String> getSearchableTokens()
                                                               throws java.lang.Exception

      Description copied from interface: `Searchable`
      Get a list of all tokens that should be visible to searching
      Specified by:
        `getSearchableTokens` in interface `Searchable`
      Overrides:
        `getSearchableTokens` in class `SampleResult`
      Returns:
        List of searchable tokens
      Throws:
        `java.lang.Exception` - when something fails while getting the searchable tokens

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