java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.protocol.http.control.Cookie
All Implemented Interfaces:
Serializable, Cloneable, Searchable, org.apache.jmeter.testelement.TestElement

public class Cookie extends AbstractTestElement implements Serializable
This class is a Cookie encapsulator.
See Also:
  • Constructor Details

    • Cookie

      public Cookie()
      create the cookie
    • Cookie

      public Cookie(String name, String value, String domain, String path, boolean secure, long expires)
      create the cookie
      Parameters:
      name - name of the cookie
      value - value of the cookie
      domain - domain for which the cookie is valid
      path - path for which the cookie is valid
      secure - flag whether cookie is to be handled as 'secure'
      expires - - this is in seconds
    • Cookie

      public Cookie(String name, String value, String domain, String path, boolean secure, long expires, boolean hasPath, boolean hasDomain)
      create the cookie
      Parameters:
      name - name of the cookie
      value - value of the cookie
      domain - domain for which the cookie is valid
      path - path for which the cookie is valid
      secure - flag whether cookie is to be handled as 'secure'
      expires - - this is in seconds
      hasPath - - was the path explicitly specified?
      hasDomain - - was the domain explicitly specified?
    • Cookie

      public Cookie(String name, String value, String domain, String path, boolean secure, long expires, boolean hasPath, boolean hasDomain, int version)
      Create a JMeter Cookie.
      Parameters:
      name - name of the cookie
      value - value of the cookie
      domain - domain for which the cookie is valid
      path - path for which the cookie is valid
      secure - flag whether cookie is to be handled as 'secure'
      expires - - this is in seconds
      hasPath - - was the path explicitly specified?
      hasDomain - - was the domain explicitly specified?
      version - - cookie spec. version
  • Method Details

    • addConfigElement

      public void addConfigElement(ConfigElement config)
    • getValue

      public String getValue()
      get the value for this object.
      Returns:
      the value of this cookie
    • setValue

      public void setValue(String value)
      set the value for this object.
      Parameters:
      value - the value of this cookie
    • getDomain

      public String getDomain()
      get the domain for this object.
      Returns:
      the domain for which this cookie is valid
    • setDomain

      public void setDomain(String domain)
      set the domain for this object.
      Parameters:
      domain - the domain for which this cookie is valid
    • getExpires

      public long getExpires()
      get the expiry time for the cookie
      Returns:
      Expiry time in seconds since the Java epoch
    • getExpiresMillis

      public long getExpiresMillis()
      get the expiry time for the cookie
      Returns:
      Expiry time in milli-seconds since the Java epoch, i.e. same as System.currentTimeMillis()
    • setExpires

      public void setExpires(long expires)
      set the expiry time for the cookie
      Parameters:
      expires - - expiry time in seconds since the Java epoch
    • getSecure

      public boolean getSecure()
      get the secure for this object.
      Returns:
      flag whether this cookie should be treated as a 'secure' cookie
    • setSecure

      public void setSecure(boolean secure)
      set the secure for this object.
      Parameters:
      secure - flag whether this cookie should be treated as a 'secure' cookie
    • getPath

      public String getPath()
      get the path for this object.
      Returns:
      the path for which this cookie is valid
    • setPath

      public void setPath(String path)
      set the path for this object.
      Parameters:
      path - the path for which this cookie is valid
    • setPathSpecified

      public void setPathSpecified(boolean b)
    • isPathSpecified

      public boolean isPathSpecified()
    • setDomainSpecified

      public void setDomainSpecified(boolean b)
    • isDomainSpecified

      public boolean isDomainSpecified()
    • toString

      public String toString()
      creates a string representation of this cookie
      Overrides:
      toString in class Object
    • getVersion

      public int getVersion()
      Returns:
      the version
    • setVersion

      public void setVersion(int version)
      Parameters:
      version - the version to set