org.apache.anteater.test
Class Session

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.types.DataType
              |
              +--org.apache.anteater.test.BaseDataType
                    |
                    +--org.apache.anteater.test.Session
All Implemented Interfaces:
Groupable

public class Session
extends BaseDataType

A minimalistic session object, for storing cookie headers between requests.

Since:
June 12, 2002
Version:
$Revision: 1.9 $ $Date: 2003/01/18 01:56:38 $
Author:
Jeff Turner

Field Summary
protected  SortedMap cookies
           
 
Fields inherited from class org.apache.anteater.test.BaseDataType
debug, debugWasSet
 
Fields inherited from class org.apache.tools.ant.types.DataType
checked, description, ref
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
Session()
           
 
Method Summary
 Header getCookieHeader(String path)
          Retrieve a 'Set-Cookie' header for the specified path.
 void setCookie(Header hdr)
          Takes a "Set-Cookie" header and stores it for later use.
 String toString()
           
 
Methods inherited from class org.apache.anteater.test.BaseDataType
debug, getDataTypeName, getDebug, getGroup, getRef, print, println, setDebug, setGroup, setGroup, setRefid
 
Methods inherited from class org.apache.tools.ant.types.DataType
circularReference, dieOnCircularReference, getCheckedRef, getDescription, isReference, noChildrenAllowed, setDescription, tooManyAttributes
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, log, log, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cookies

protected SortedMap cookies
Constructor Detail

Session

public Session()
Method Detail

setCookie

public void setCookie(Header hdr)
Takes a "Set-Cookie" header and stores it for later use. Vastly oversimplifies cookie parsing, completely unrobust. See rfc2109


getCookieHeader

public Header getCookieHeader(String path)
Retrieve a 'Set-Cookie' header for the specified path. Tries to match the longest path first. Ie, if cookies for paths '/' and '/foo' are set, then a request for '/foo/bar' will match the '/foo' cookie before the '/' cookie.

Parameters:
path - Eg '/myapp/foo.jsp' or '/servlet/SessionServlet'
Returns:
A header, Cookie: JSESSIONID=........

toString

public String toString()
Overrides:
toString in class Object


Ant Functional Tester -- see Project home page for details