org.apache.tomcat.util.http
Class ServerCookie

java.lang.Object
  extended by org.apache.tomcat.util.http.ServerCookie
All Implemented Interfaces:
java.io.Serializable

public class ServerCookie
extends java.lang.Object
implements java.io.Serializable

Server-side cookie representation. Allows recycling and uses MessageBytes as low-level representation ( and thus the byte-> char conversion can be delayed until we know the charset ). Tomcat.core uses this recyclable object to represent cookies, and the facade will convert it to the external representation.

See Also:
Serialized Form

Constructor Summary
ServerCookie()
           
 
Method Summary
static boolean alreadyQuoted(java.lang.String value)
           
static void appendCookieValue(java.lang.StringBuffer headerBuf, int version, java.lang.String name, java.lang.String value, java.lang.String path, java.lang.String domain, java.lang.String comment, int maxAge, boolean isSecure)
           
static boolean checkName(java.lang.String name)
          Deprecated. - Not used
static boolean containsCTL(java.lang.String value, int version)
           
 MessageBytes getComment()
           
 java.lang.String getCookieHeaderName()
          Return the header name to set the cookie, based on cookie version.
static java.lang.String getCookieHeaderName(int version)
          Return the header name to set the cookie, based on cookie version.
 MessageBytes getDomain()
           
 int getMaxAge()
           
 MessageBytes getName()
           
 MessageBytes getPath()
           
 boolean getSecure()
           
 MessageBytes getValue()
           
 int getVersion()
           
static boolean isToken(java.lang.String value)
           
static boolean isToken2(java.lang.String value)
           
static void maybeQuote(int version, java.lang.StringBuffer buf, java.lang.String value)
          Deprecated. - Not used
static void maybeQuote2(int version, java.lang.StringBuffer buf, java.lang.String value)
          Quotes values using rules that vary depending on Cookie version.
 void recycle()
           
 void setMaxAge(int expiry)
           
 void setSecure(boolean flag)
           
 void setVersion(int v)
           
 java.lang.String toString()
           
static void unescapeDoubleQuotes(ByteChunk bc)
          Unescapes any double quotes in the given cookie value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerCookie

public ServerCookie()
Method Detail

recycle

public void recycle()

getComment

public MessageBytes getComment()

getDomain

public MessageBytes getDomain()

setMaxAge

public void setMaxAge(int expiry)

getMaxAge

public int getMaxAge()

getPath

public MessageBytes getPath()

setSecure

public void setSecure(boolean flag)

getSecure

public boolean getSecure()

getName

public MessageBytes getName()

getValue

public MessageBytes getValue()

getVersion

public int getVersion()

setVersion

public void setVersion(int v)

toString

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

isToken

public static boolean isToken(java.lang.String value)

containsCTL

public static boolean containsCTL(java.lang.String value,
                                  int version)

isToken2

public static boolean isToken2(java.lang.String value)

checkName

public static boolean checkName(java.lang.String name)
Deprecated. - Not used


getCookieHeaderName

public java.lang.String getCookieHeaderName()
Return the header name to set the cookie, based on cookie version.


getCookieHeaderName

public static java.lang.String getCookieHeaderName(int version)
Return the header name to set the cookie, based on cookie version.


appendCookieValue

public static void appendCookieValue(java.lang.StringBuffer headerBuf,
                                     int version,
                                     java.lang.String name,
                                     java.lang.String value,
                                     java.lang.String path,
                                     java.lang.String domain,
                                     java.lang.String comment,
                                     int maxAge,
                                     boolean isSecure)

maybeQuote

@Deprecated
public static void maybeQuote(int version,
                                         java.lang.StringBuffer buf,
                                         java.lang.String value)
Deprecated. - Not used


alreadyQuoted

public static boolean alreadyQuoted(java.lang.String value)

maybeQuote2

public static void maybeQuote2(int version,
                               java.lang.StringBuffer buf,
                               java.lang.String value)
Quotes values using rules that vary depending on Cookie version.

Parameters:
version -
buf -
value -

unescapeDoubleQuotes

public static void unescapeDoubleQuotes(ByteChunk bc)
Unescapes any double quotes in the given cookie value.

Parameters:
bc - The cookie value to modify


Copyright ? 2000-2007 Apache Software Foundation. All Rights Reserved.