com.sun.grizzly.util.http
Class ServerCookie

java.lang.Object
  extended by com.sun.grizzly.util.http.ServerCookie
All Implemented Interfaces:
Serializable

public class ServerCookie
extends Object
implements 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

Field Summary
static boolean ALWAYS_ADD_EXPIRES
          If set to false, we don't use the IE6/7 Max-Age/Expires work around
 
Constructor Summary
ServerCookie()
           
 
Method Summary
static boolean alreadyQuoted(String value)
           
static void appendCookieValue(StringBuffer headerBuf, int version, String name, String value, String path, String domain, String comment, int maxAge, boolean isSecure)
           
static void appendCookieValue(StringBuffer headerBuf, int version, String name, String value, String path, String domain, String comment, int maxAge, boolean isSecure, boolean isHttpOnly)
           
static boolean containsCTL(String value, int version)
           
 MessageBytes getComment()
           
 String getCookieHeaderName()
          Return the header name to set the cookie, based on cookie version.
static 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(String value)
           
static boolean isToken(String value, String literals)
           
static boolean isToken2(String value)
           
static boolean isToken2(String value, String literals)
           
static int maybeQuote2(int version, StringBuffer buf, String value)
          Quotes values using rules that vary depending on Cookie version.
static int maybeQuote2(int version, StringBuffer buf, String value, boolean allowVersionSwitch)
           
static int maybeQuote2(int version, StringBuffer buf, String value, String literals, boolean allowVersionSwitch)
           
 void recycle()
           
 void setMaxAge(int expiry)
           
 void setSecure(boolean flag)
           
 void setVersion(int v)
           
 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
 

Field Detail

ALWAYS_ADD_EXPIRES

public static final boolean ALWAYS_ADD_EXPIRES
If set to false, we don't use the IE6/7 Max-Age/Expires work around

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 String toString()
Overrides:
toString in class Object

isToken

public static boolean isToken(String value)

isToken

public static boolean isToken(String value,
                              String literals)

containsCTL

public static boolean containsCTL(String value,
                                  int version)

isToken2

public static boolean isToken2(String value)

isToken2

public static boolean isToken2(String value,
                               String literals)

getCookieHeaderName

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


getCookieHeaderName

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


appendCookieValue

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

appendCookieValue

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

alreadyQuoted

public static boolean alreadyQuoted(String value)

maybeQuote2

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

Parameters:
version -
buf -
value -

maybeQuote2

public static int maybeQuote2(int version,
                              StringBuffer buf,
                              String value,
                              boolean allowVersionSwitch)

maybeQuote2

public static int maybeQuote2(int version,
                              StringBuffer buf,
                              String value,
                              String literals,
                              boolean allowVersionSwitch)

unescapeDoubleQuotes

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

Parameters:
bc - The cookie value to modify


Copyright © 2012 Oracle Corporation. All Rights Reserved.