org.apache.cocoon.environment.portlet
Class PortletCookie

java.lang.Object
  extended by org.apache.cocoon.environment.portlet.PortletCookie
All Implemented Interfaces:
Cookie

public final class PortletCookie
extends Object
implements Cookie

Implements Cookie interface for the JSR-168 Portlet environment. Portlet preferences are available in the Cocoon as Cookie objects.

Version:
CVS $Id: PortletCookie.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Alex Rudnev, Vadim Gritsenko

Constructor Summary
PortletCookie(String name, String value)
           
 
Method Summary
 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.
 boolean getSecure()
          Returns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.
 String getValue()
          Returns the value of the cookie.
 int getVersion()
          Returns the version of the protocol this cookie complies with.
 void init(String name, String value)
          Constructs a cookie with a specified name and value.
 void setComment(String purpose)
          This method does nothing
 void setDomain(String pattern)
          This method does nothing
 void setMaxAge(int expiry)
          This method does nothing
 void setPath(String uri)
          This method does nothing
 void setSecure(boolean flag)
          This method does nothing
 void setValue(String newValue)
          Assigns a new value to a cookie after the cookie is created.
 void setVersion(int v)
          Sets the version of the cookie protocol this cookie complies with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletCookie

public PortletCookie(String name,
                     String value)
Method Detail

init

public void init(String name,
                 String value)
Constructs a cookie with a specified name and value.

Parameters:
name - a String specifying the name of the cookie
value - a String specifying the value of the cookie
See Also:
setValue(String)

setComment

public void setComment(String purpose)
This method does nothing

Specified by:
setComment in interface Cookie
Parameters:
purpose - a String specifying the comment to display to the user
See Also:
Cookie.getComment()

getComment

public String getComment()
Description copied from interface: Cookie
Returns the comment describing the purpose of this cookie, or null if the cookie has no comment.

Specified by:
getComment in interface Cookie
Returns:
null
See Also:
setComment(String)

setDomain

public void setDomain(String pattern)
This method does nothing

Specified by:
setDomain in interface Cookie
Parameters:
pattern - a String containing the domain name within which this cookie is visible; form is according to RFC 2109
See Also:
Cookie.getDomain()

getDomain

public String getDomain()
Description copied from interface: Cookie
Returns the domain name set for this cookie. The form of the domain name is set by RFC 2109.

Specified by:
getDomain in interface Cookie
Returns:
null
See Also:
setDomain(String)

setMaxAge

public void setMaxAge(int expiry)
This method does nothing

Specified by:
setMaxAge in interface Cookie
Parameters:
expiry - an integer specifying the maximum age of the cookie in seconds; if negative, means the cookie is not stored; if zero, deletes the cookie
See Also:
Cookie.getMaxAge()

getMaxAge

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

Specified by:
getMaxAge in interface Cookie
Returns:
Integer.MAX_VALUE
See Also:
setMaxAge(int)

setPath

public void setPath(String uri)
This method does nothing

Specified by:
setPath in interface Cookie
Parameters:
uri - a String specifying a path
See Also:
Cookie.getPath()

getPath

public String getPath()
Description copied from interface: Cookie
Returns the path on the server to which the browser returns this cookie. The cookie is visible to all subpaths on the server.

Specified by:
getPath in interface Cookie
Returns:
empty string
See Also:
setPath(String)

setSecure

public void setSecure(boolean flag)
This method does nothing

Specified by:
setSecure in interface Cookie
Parameters:
flag - if true, sends the cookie from the browser to the server using only when using a secure protocol; if false, sent on any protocol
See Also:
getSecure()

getSecure

public boolean getSecure()
Description copied from interface: Cookie
Returns true if the browser is sending cookies only over a secure protocol, or false if the browser can send cookies using any protocol.

Specified by:
getSecure in interface Cookie
Returns:
false
See Also:
setSecure(boolean)

getName

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

Specified by:
getName in interface Cookie
Returns:
a String specifying the cookie's name

setValue

public void setValue(String newValue)
Assigns a new value to a cookie after the cookie is created. If you use a binary value, you may want to use BASE64 encoding.

With Version 0 cookies, values should not contain white space, brackets, parentheses, equals signs, commas, double quotes, slashes, question marks, at signs, colons, and semicolons. Empty values may not behave the same way on all browsers.

Specified by:
setValue in interface Cookie
Parameters:
newValue - a String specifying the new value
See Also:
getValue(), Cookie

getValue

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

Specified by:
getValue in interface Cookie
Returns:
a String containing the cookie's present value
See Also:
setValue(String), Cookie

getVersion

public int getVersion()
Returns the version of the protocol this cookie complies with.

Specified by:
getVersion in interface Cookie
Returns:
Always 0
See Also:
setVersion(int)

setVersion

public void setVersion(int v)
Sets the version of the cookie protocol this cookie complies with. This method does nothing, version 0 is always returned in getVersion

Specified by:
setVersion in interface Cookie
Parameters:
v - 0 if the cookie should comply with the original Netscape specification; 1 if the cookie should comply with RFC 2109
See Also:
getVersion()


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.