org.glassfish.grizzly.http
Class LazyCookie

java.lang.Object
  extended by org.glassfish.grizzly.http.Cookie
      extended by org.glassfish.grizzly.http.LazyCookie
All Implemented Interfaces:
Cloneable

public class LazyCookie
extends Cookie

Lazy wrapper over Cookie. The String representations of the cookie's attributes will be initialized on the first get...() call.

Author:
Alexey Stashok

Field Summary
 
Fields inherited from class org.glassfish.grizzly.http.Cookie
comment, domain, isHttpOnly, maxAge, name, path, secure, value, version
 
Constructor Summary
LazyCookie()
           
 
Method Summary
protected  void checkInitialized()
           
 String getComment()
          Returns the comment describing the purpose of this cookie, or null if the cookie has no comment.
 String getDomain()
          Returns the domain name set for this cookie.
 int getMaxAge()
          Returns the maximum age of the cookie, specified in seconds, By default, -1 indicating the cookie will persist until browser shutdown.
 String getName()
          Returns the name of the cookie.
 String getPath()
          Returns the path on the server to which the browser returns this cookie.
 String getValue()
          Returns the value of the cookie.
 int getVersion()
          Returns the version of the protocol this cookie complies with.
protected  void initialize()
           
 boolean isSecure()
          Returns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.
 LazyCookieState lazy()
          Returns the lazy state representation.
protected  boolean lazyNameEquals(String name)
           
 void recycle()
           
protected  String unescape(String s)
           
 
Methods inherited from class org.glassfish.grizzly.http.Cookie
asClientCookieBuffer, asClientCookieBuffer, asClientCookieString, asServerCookieBuffer, asServerCookieBuffer, asServerCookieString, checkName, clone, getCookieHeaderName, getCookieHeaderName, isHttpOnly, setComment, setDomain, setHttpOnly, setMaxAge, setPath, setSecure, setValue, setVersion
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyCookie

public LazyCookie()
Method Detail

getName

public String getName()
Returns the name of the cookie. The name cannot be changed after creation.

Overrides:
getName in class Cookie
Returns:
a String specifying the cookie's name

getValue

public String getValue()
Returns the value of the cookie.

Overrides:
getValue in class Cookie
Returns:
a String containing the cookie's present value
See Also:
Cookie.setValue(java.lang.String), Cookie

getVersion

public int getVersion()
Returns the version of the protocol this cookie complies with. Version 1 complies with RFC 2109, and version 0 complies with the original cookie specification drafted by Netscape. Cookies provided by a browser use and identify the browser's cookie version.

Overrides:
getVersion in class Cookie
Returns:
0 if the cookie complies with the original Netscape specification; 1 if the cookie complies with RFC 2109
See Also:
Cookie.setVersion(int)

getComment

public String getComment()
Returns the comment describing the purpose of this cookie, or null if the cookie has no comment.

Overrides:
getComment in class Cookie
Returns:
a String containing the comment, or null if none
See Also:
Cookie.setComment(java.lang.String)

getDomain

public String getDomain()
Returns the domain name set for this cookie. The form of the domain name is set by RFC 2109.

Overrides:
getDomain in class Cookie
Returns:
a String containing the domain name
See Also:
Cookie.setDomain(java.lang.String)

getMaxAge

public int getMaxAge()
Returns the maximum age of the cookie, specified in seconds, By default, -1 indicating the cookie will persist until browser shutdown.

Overrides:
getMaxAge in class Cookie
Returns:
an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie persists until browser shutdown
See Also:
Cookie.setMaxAge(int)

getPath

public String getPath()
Returns the path on the server to which the browser returns this cookie. The cookie is visible to all subpaths on the server.

Overrides:
getPath in class Cookie
Returns:
a String specifying a path that contains a servlet name, for example, /catalog
See Also:
Cookie.setPath(java.lang.String)

isSecure

public boolean isSecure()
Returns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.

Overrides:
isSecure in class Cookie
Returns:
true if the browser uses a secure protocol; otherwise, true
See Also:
Cookie.setSecure(boolean)

checkInitialized

protected final void checkInitialized()

initialize

protected void initialize()

lazy

public LazyCookieState lazy()
Returns the lazy state representation.

Returns:
the lazy state representation.

lazyNameEquals

protected boolean lazyNameEquals(String name)
Overrides:
lazyNameEquals in class Cookie

recycle

public void recycle()

unescape

protected String unescape(String s)


Copyright © 2010 Oracle Corpration. All Rights Reserved.