org.owasp.webscarab.model
Class Cookie

java.lang.Object
  extended by org.owasp.webscarab.model.Cookie

public class Cookie
extends java.lang.Object

Represents a cookie received from a web server From rfc 2109 The syntax for the Set-Cookie response header is set-cookie = "Set-Cookie:" cookies cookies = 1#cookie cookie = NAME "=" VALUE *(";" cookie-av) NAME = attr VALUE = value cookie-av = "Comment" "=" value | "Domain" "=" value | "Max-Age" "=" value | "Path" "=" value | "Secure" | "Version" "=" 1*DIGIT added support for Microsoft's new httponly flag - untested, and largely unused!

Author:
rdawes

Constructor Summary
Cookie(java.util.Date date, HttpUrl url, java.lang.String setHeader)
          Creates a new instance of Cookie
Cookie(java.util.Date date, java.lang.String setHeader)
          This variant of the constuctor should only be called when we are sure that the Set-Cookie header already contains the domain and path.
 
Method Summary
 java.lang.String getComment()
          returns the comment of the cookie
 java.util.Date getDate()
          returns the date/time the cookie was created
 java.lang.String getDomain()
          returns the domain of the cookie
 boolean getHTTPOnly()
          indicates whther this cookie had MS's "httpOnly" flag set
 java.lang.String getKey()
          an identifier for the cookie "name", made up of the domain, the path, and the name of the cookie
 java.lang.String getMaxAge()
          returns the maximum age of the cookie
 java.lang.String getName()
          returns the name of the cookie
 java.lang.String getPath()
          returns the path of the cookie
 boolean getSecure()
          indicates whether this cookie had the "secure" flag set
 java.lang.String getValue()
          returns the value of the cookie
 java.lang.String getVersion()
          returns the version of the cookie
 java.lang.String setCookie()
          returns a string equivalent to the complete "Set-Cookie" header that would have been sent.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cookie

public Cookie(java.util.Date date,
              HttpUrl url,
              java.lang.String setHeader)
Creates a new instance of Cookie

Parameters:
date - the date the cookie was created/received
url - the URL the the cookie was sent back from
setHeader - the actual "Set-Cookie" header value

Cookie

public Cookie(java.util.Date date,
              java.lang.String setHeader)
This variant of the constuctor should only be called when we are sure that the Set-Cookie header already contains the domain and path. e.g. when we are reading the cookies from disk

Parameters:
date - The date the cookie was created or received
setHeader - a complete Set-Cookie header
Method Detail

getKey

public java.lang.String getKey()
an identifier for the cookie "name", made up of the domain, the path, and the name of the cookie

Returns:
the identifier

getDate

public java.util.Date getDate()
returns the date/time the cookie was created

Returns:
the Date

getName

public java.lang.String getName()
returns the name of the cookie

Returns:
the name of the cookie

getValue

public java.lang.String getValue()
returns the value of the cookie

Returns:
the value of the cookie

getDomain

public java.lang.String getDomain()
returns the domain of the cookie

Returns:
the domain of the cookie

getMaxAge

public java.lang.String getMaxAge()
returns the maximum age of the cookie

Returns:
the maximum age of the cookie

getPath

public java.lang.String getPath()
returns the path of the cookie

Returns:
the path of the cookie

getSecure

public boolean getSecure()
indicates whether this cookie had the "secure" flag set

Returns:
true if the "secure" flag was set

getHTTPOnly

public boolean getHTTPOnly()
indicates whther this cookie had MS's "httpOnly" flag set

Returns:
true if the "httpOnly" flag was set

getVersion

public java.lang.String getVersion()
returns the version of the cookie

Returns:
the version of the cookie

getComment

public java.lang.String getComment()
returns the comment of the cookie

Returns:
the comment of the cookie

setCookie

public java.lang.String setCookie()
returns a string equivalent to the complete "Set-Cookie" header that would have been sent.

Returns:
a string equivalent to the complete "Set-Cookie" header that would have been sent.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object