Class HTTPSampleResult

java.lang.Object
org.apache.jmeter.samplers.SampleResult
org.apache.jmeter.protocol.http.sampler.HTTPSampleResult
All Implemented Interfaces:
Serializable, Cloneable, Searchable

public class HTTPSampleResult extends SampleResult
This is a specialisation of the SampleResult class for the HTTP protocol.
See Also:
  • Constructor Details

    • 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 Details

    • setHTTPMethod

      public void setHTTPMethod(String method)
    • getHTTPMethod

      public String getHTTPMethod()
    • setRedirectLocation

      public void setRedirectLocation(String redirectLocation)
    • getRedirectLocation

      public String getRedirectLocation()
    • isRedirect

      public boolean isRedirect()
      Determine whether this result is a redirect.

      If status is 307, the request has to be a HTTP method of GET or HEAD, to be considered a redirect. For all other status codes, the HTTP method will not be checked.

      Returns true for: 301, 302, 303, 307 (GET or HEAD) and 308
      Returns:
      true iff res is an HTTP redirect response
    • getSamplerData

      public String getSamplerData()
      Overrides version in Sampler data to provide more details

      Overrides:
      getSamplerData in class SampleResult
    • getCookies

      public String getCookies()
      Returns:
      cookies as a string
    • setCookies

      public void setCookies(String string)
      Parameters:
      string - representing the cookies
    • getQueryString

      public String getQueryString()
      Fetch the query string
      Returns:
      the query string
    • setQueryString

      public void setQueryString(String string)
      Save the query string
      Parameters:
      string - the query string
    • getDataEncodingWithDefault

      public String getDataEncodingWithDefault(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 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 List<String> getSearchableTokens() throws 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:
      Exception - when something fails while getting the searchable tokens
    • appendDebugParameters

      protected void appendDebugParameters(StringBuilder sb)
      Overrides:
      appendDebugParameters in class SampleResult