Class CookieManager
-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable,org.apache.jmeter.config.ConfigElement,org.apache.jmeter.gui.Searchable,org.apache.jmeter.testelement.TestElement,org.apache.jmeter.testelement.TestIterationListener,org.apache.jmeter.testelement.TestStateListener
public class CookieManager extends ConfigTestElement implements TestStateListener, TestIterationListener, Serializable
This class provides an interface to the netscape cookies file to pass cookies along with a request.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringUSERNAMEpublic final static StringPASSWORDpublic transient JMeterContextthreadContextpublic transient StringthreadNamepublic final static TestElement.CompanionCompanionpublic final static StringNAMEpublic final static StringGUI_CLASSpublic final static StringENABLEDpublic final static StringTEST_CLASSpublic final static StringCOMMENTS
-
Constructor Summary
Constructors Constructor Description CookieManager()
-
Method Summary
Modifier and Type Method Description Objectclone()StringgetPolicy()voidsetCookiePolicy(String policy)CollectionPropertygetCookies()intgetCookieCount()booleangetClearEachIteration()voidsetClearEachIteration(boolean clear)booleangetControlledByThread()voidsetControlledByThread(boolean control)StringgetImplementation()voidsetImplementation(String implementation)voidsave(String authFile)Save the static cookie data to a file. voidaddFile(String cookieFile)Add cookie data from a file. voidrecoverRunningVersion()voidsetRunningVersion(boolean running)voidadd(Cookie c)Add a cookie. voidclear()voidremove(int index)Remove a cookie. Cookieget(int i)Return the cookie at index i. StringgetCookieHeaderForURL(URL url)Find cookies applicable to the given URL and build the Cookie header from them. voidaddCookieFromHeader(String cookieHeader, URL url)voidtestStarted()voidtestEnded()voidtestStarted(String host)voidtestEnded(String host)voidtestIterationStart(LoopIterationEvent event)-
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
canRemove, clearTestElementChildren, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, propertyIterator, removeProperty, setComment, setEnabled, setName, setProperty, setTemporary, setThreadContext, setThreadName, traverse -
Methods inherited from class org.apache.jmeter.config.ConfigTestElement
addConfigElement, addTestElement, expectsModification, getProps, getSchema -
Methods inherited from class org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProps, getSchema, getString, removed, set -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
setCookiePolicy
void setCookiePolicy(String policy)
-
getCookies
CollectionProperty getCookies()
-
getCookieCount
int getCookieCount()
-
getClearEachIteration
boolean getClearEachIteration()
-
setClearEachIteration
void setClearEachIteration(boolean clear)
-
getControlledByThread
boolean getControlledByThread()
-
setControlledByThread
void setControlledByThread(boolean control)
-
getImplementation
String getImplementation()
-
setImplementation
void setImplementation(String implementation)
-
save
void save(String authFile)
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.
-
addFile
void addFile(String cookieFile)
Add cookie data from a file.
- Parameters:
cookieFile- name of the file to read the cookies from.
-
recoverRunningVersion
void recoverRunningVersion()
-
setRunningVersion
void setRunningVersion(boolean running)
-
clear
void clear()
-
remove
void remove(int index)
Remove a cookie.
- Parameters:
index- index of the cookie to remove
-
getCookieHeaderForURL
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.
-
addCookieFromHeader
void addCookieFromHeader(String cookieHeader, URL url)
-
testStarted
void testStarted()
-
testEnded
void testEnded()
-
testStarted
void testStarted(String host)
-
testIterationStart
void testIterationStart(LoopIterationEvent event)
-
-
-
-