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 String
USERNAME
public final static String
PASSWORD
public transient JMeterContext
threadContext
public transient String
threadName
public final static TestElement.Companion
Companion
public final static String
NAME
public final static String
GUI_CLASS
public final static String
ENABLED
public final static String
TEST_CLASS
public final static String
COMMENTS
-
Constructor Summary
Constructors Constructor Description CookieManager()
-
Method Summary
Modifier and Type Method Description Object
clone()
String
getPolicy()
void
setCookiePolicy(String policy)
CollectionProperty
getCookies()
int
getCookieCount()
boolean
getClearEachIteration()
void
setClearEachIteration(boolean clear)
boolean
getControlledByThread()
void
setControlledByThread(boolean control)
String
getImplementation()
void
setImplementation(String implementation)
void
save(String authFile)
Save the static cookie data to a file. void
addFile(String cookieFile)
Add cookie data from a file. void
recoverRunningVersion()
void
setRunningVersion(boolean running)
void
add(Cookie c)
Add a cookie. void
clear()
void
remove(int index)
Remove a cookie. Cookie
get(int i)
Return the cookie at index i. String
getCookieHeaderForURL(URL url)
Find cookies applicable to the given URL and build the Cookie header from them. void
addCookieFromHeader(String cookieHeader, URL url)
void
testStarted()
void
testEnded()
void
testStarted(String host)
void
testEnded(String host)
void
testIterationStart(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)
-
-
-
-