Class CookieManager

    • Field Detail

      • DEFAULT_POLICY

        public static final String DEFAULT_POLICY
      • DEFAULT_IMPLEMENTATION

        public static final String DEFAULT_IMPLEMENTATION
    • Constructor Detail

      • CookieManager

        public CookieManager()
    • Method Detail

      • getPolicy

        public String getPolicy()
      • setCookiePolicy

        public void setCookiePolicy​(String policy)
      • getCookieCount

        public int getCookieCount()
      • getClearEachIteration

        public boolean getClearEachIteration()
      • setClearEachIteration

        public void setClearEachIteration​(boolean clear)
      • getImplementation

        public String getImplementation()
      • setImplementation

        public void setImplementation​(String implementation)
      • save

        public void save​(String authFile)
                  throws IOException
        Save the static cookie data to a file.

        Cookies are only taken from the GUI - runtime cookies are not included.

        Parameters:
        authFile - name of the file to store the cookies into. If the name is relative, the system property user.dir will be prepended
        Throws:
        IOException - when writing to that file fails
      • addFile

        public void addFile​(String cookieFile)
                     throws IOException
        Add cookie data from a file.
        Parameters:
        cookieFile - name of the file to read the cookies from. If the name is relative, the system property user.dir will be prepended
        Throws:
        IOException - if reading the file fails
      • add

        public void add​(Cookie c)
        Add a cookie.
        Parameters:
        c - cookie to be added
      • remove

        public void remove​(int index)
        Remove a cookie.
        Parameters:
        index - index of the cookie to remove
      • get

        public Cookie get​(int i)
        Return the cookie at index i.
        Parameters:
        i - index of the cookie to get
        Returns:
        cookie at index i
      • getCookieHeaderForURL

        public String getCookieHeaderForURL​(URL url)
        Find cookies applicable to the given URL and build the Cookie header from them.
        Parameters:
        url - URL of the request to which the returned header will be added.
        Returns:
        the value string for the cookie header (goes after "Cookie: ").
      • addCookieFromHeader

        public void addCookieFromHeader​(String cookieHeader,
                                        URL url)
      • 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()
      • 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()
      • testStarted

        public void testStarted​(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()
      • testEnded

        public void testEnded​(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()
      • testIterationStart

        public void testIterationStart​(LoopIterationEvent event)
        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