Apache JMeter
1.9

org.apache.jmeter.protocol.http.control
Class CookieManager

java.lang.Object
  |
  +--org.apache.jmeter.testelement.AbstractTestElement
        |
        +--org.apache.jmeter.config.ConfigTestElement
              |
              +--org.apache.jmeter.protocol.http.control.CookieManager
All Implemented Interfaces:
Cloneable, Serializable, TestElement, TestListener

public class CookieManager
extends ConfigTestElement
implements TestListener, Serializable

This class provides an interface to the netscape cookies file to pass cookies along with a request.

Version:
$Revision: 1.14 $ $Date: 2003/07/18 14:38:01 $
Author:
Sean Dowd
See Also:
Serialized Form

Nested Class Summary
static class CookieManager.Test
           
 
Field Summary
static String CLEAR
           
static String COOKIES
           
 
Fields inherited from class org.apache.jmeter.config.ConfigTestElement
PASSWORD, USERNAME
 
Fields inherited from class org.apache.jmeter.testelement.AbstractTestElement
log
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
CookieManager()
           
 
Method Summary
 void add()
          add an empty cookie
 void add(Cookie c)
          add a cookie
 void addCookieFromHeader(String cookieHeader, URL url)
           
 void addFile(String cookieFile)
          add cookie data from a file
 void clear()
          Remove all the cookie
 long convertDateFormatStrToLong(String dateStr)
           
 String convertLongToDateFormatStr(long dateLong)
           
 Cookie get(int i)
          return the cookie at index i
 String getClassLabel()
           
 boolean getClearEachIteration()
           
 Cookie getCookie(int row)
           
 int getCookieCount()
           
 String getCookieHeaderForURL(URL url)
           
 CollectionProperty getCookies()
           
 void recoverRunningVersion()
          Tells the test element to return to the state it was in when makeRunningVersion() was called.
 void remove(int index)
          remove a cookie
 void removeCookieNamed(String name)
           
 void save(String authFile)
          save the cookie data to a file
 void setClearEachIteration(boolean clear)
           
 void setRunningVersion(boolean running)
          Sets the runningVersion.
 int size()
          return the number cookies
 String[] split(String splittee, String splitChar, String def)
          Takes a String and a tokenizer character, and returns a new array of strings of the string split by the tokenizer character.
 void testEnded()
           
 void testEnded(String host)
           
 void testIterationStart(LoopIterationEvent event)
          Each time through a Thread Group's test script, an iteration event is fired.
 void testStarted()
           
 void testStarted(String host)
           
 
Methods inherited from class org.apache.jmeter.config.ConfigTestElement
addTestElement
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, clone, equals, getName, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, isRunningVersion, logProperties, mergeIn, nextIsNull, propertyIterator, removeProperty, setName, setProperty, setProperty, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLEAR

public static final String CLEAR
See Also:
Constant Field Values

COOKIES

public static final String COOKIES
See Also:
Constant Field Values
Constructor Detail

CookieManager

public CookieManager()
Method Detail

getCookies

public CollectionProperty getCookies()

getCookieCount

public int getCookieCount()

getClearEachIteration

public boolean getClearEachIteration()

setClearEachIteration

public void setClearEachIteration(boolean clear)

getCookie

public Cookie getCookie(int row)

save

public void save(String authFile)
          throws IOException
save the cookie data to a file

IOException

addFile

public void addFile(String cookieFile)
             throws IOException
add cookie data from a file

IOException

recoverRunningVersion

public void recoverRunningVersion()
Description copied from interface: TestElement
Tells the test element to return to the state it was in when makeRunningVersion() was called.

Specified by:
recoverRunningVersion in interface TestElement
Overrides:
recoverRunningVersion in class AbstractTestElement

setRunningVersion

public void setRunningVersion(boolean running)
Description copied from class: AbstractTestElement
Sets the runningVersion.

Specified by:
setRunningVersion in interface TestElement
Overrides:
setRunningVersion in class AbstractTestElement
Parameters:
running - the runningVersion to set

add

public void add(Cookie c)
add a cookie


add

public void add()
add an empty cookie


clear

public void clear()
Remove all the cookie

Specified by:
clear in interface TestElement
Overrides:
clear in class AbstractTestElement

remove

public void remove(int index)
remove a cookie


size

public int size()
return the number cookies


get

public Cookie get(int i)
return the cookie at index i


convertLongToDateFormatStr

public String convertLongToDateFormatStr(long dateLong)

convertDateFormatStrToLong

public long convertDateFormatStrToLong(String dateStr)

getCookieHeaderForURL

public String getCookieHeaderForURL(URL url)

addCookieFromHeader

public void addCookieFromHeader(String cookieHeader,
                                URL url)

removeCookieNamed

public void removeCookieNamed(String name)

split

public String[] split(String splittee,
                      String splitChar,
                      String def)
Takes a String and a tokenizer character, and returns a new array of strings of the string split by the tokenizer character.

Parameters:
splittee - String to be split
splitChar - Character to split the string on
def - Default value to place between two split chars that have nothing between them
Returns:
Array of all the tokens.

getClassLabel

public String getClassLabel()

testStarted

public void testStarted()
Specified by:
testStarted in interface TestListener

testEnded

public void testEnded()
Specified by:
testEnded in interface TestListener

testStarted

public void testStarted(String host)
Specified by:
testStarted in interface TestListener

testEnded

public void testEnded(String host)
Specified by:
testEnded in interface TestListener

testIterationStart

public void testIterationStart(LoopIterationEvent event)
Description copied from interface: TestListener
Each time through a Thread Group's test script, an iteration event is fired.

Specified by:
testIterationStart in interface TestListener
Parameters:
event -

Apache JMeter
1.9

Copyright © 1998-2003 Apache Software Foundation. All Rights Reserved.