org.apache.cocoon.components.language.markup.xsp
Class XSPCookieHelper

java.lang.Object
  extended by org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper
      extended by org.apache.cocoon.components.language.markup.xsp.XSPCookieHelper

public class XSPCookieHelper
extends XSPObjectHelper

This class is a helper class used by Cookie logicsheet This class contains following methods:

 public static void addCookie(Map , String , String , String , String ,
                              int , String , String , int);
 public static Cookie[] getCookies(Map);
 public static void getCookies(Map , ContentHandler)
     throws SAXException;
 public static Cookie getCookie(Map , String ,int )
     throws SAXException;
 public static void getCookie(Map ,String ,int , ContentHandler)
     throws SAXException;
 public static String getComment(Map ,String , int);
 public static String getDomain(Map , String , int);
 public static String getMaxAge(Map ,String , int);
 public static String getName(Map ,String , int);
 public static String getPath(Map , String , int);
 public static String getSecure(Map , String , int);
 public static String getValue(Map , String , int);
 public static String getVersion(Map , String , int);
 private static String returnCookieProperty(Map ,String ,int ,String );
 

Version:
CVS $Id: XSPCookieHelper.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Constructor Summary
XSPCookieHelper()
           
 
Method Summary
static void addCookie(Map objectModel, String name, String value, String comment, String domain, int maxage, String path, String secure, int version)
          This method will set a new cookie with values that are passed through parameters
static String getComment(Map objectModel, String cookieName, int cookieIndex)
          Method to return the value of comment for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)
static Cookie getCookie(Map objectModel, String cookieName, int cookieIndex)
          Method used to return a cookie object based on the name or the index that was passed If both name and index of cookie to be extracted is passed in, name will take precedence.
static void getCookie(Map objectModel, String cookieName, int cookieIndex, ContentHandler contentHandler)
          This method is used to find a cookie by it's name or index and place it in the XML resulting tree The xml structure that will be inserted will be, <cookie> <name>......
static Cookie[] getCookies(Map objectModel)
          This method is used to return all the cookies that present in the passed request object
static void getCookies(Map objectModel, ContentHandler contentHandler)
          This method is used to write the values of all the cookies in the resulting XML tree The structure that will be added to the XML tree will be <cookies> <cookie> <name>......
static String getDomain(Map objectModel, String cookieName, int cookieIndex)
          Method to return the value of domain for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)
static String getMaxAge(Map objectModel, String cookieName, int cookieIndex)
          Method to return the value of maxage for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)
static String getName(Map objectModel, String cookieName, int cookieIndex)
          Method to return the value of name for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)
static String getPath(Map objectModel, String cookieName, int cookieIndex)
          Method to return the value of path for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)
static String getSecure(Map objectModel, String cookieName, int cookieIndex)
          Method to return the value of secure property for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)
static String getValue(Map objectModel, String cookieName, int cookieIndex)
          Method to return the value for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)
static String getVersion(Map objectModel, String cookieName, int cookieIndex)
          Method to return the version of comment for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)
 
Methods inherited from class org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper
addAttribute, data, elementData, elementData, end, start, start, xspExpr, xspExpr, xspExpr, xspExpr, xspExpr, xspExpr, xspExpr, xspExpr, xspExpr, xspExpr, xspExpr, xspExpr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSPCookieHelper

public XSPCookieHelper()
Method Detail

addCookie

public static void addCookie(Map objectModel,
                             String name,
                             String value,
                             String comment,
                             String domain,
                             int maxage,
                             String path,
                             String secure,
                             int version)
This method will set a new cookie with values that are passed through parameters

Parameters:
objectModel -
name - name to be set for the cookie
value - value to be set for the cookie
comment - comment to be set for the cookie
domain - domain to be set for the cookie
maxage - maxage to be set for the cookie
path - path to be set for the cookie
secure - secure property to be set for the cookie
version - version to be set for the cookie

getCookies

public static Cookie[] getCookies(Map objectModel)
This method is used to return all the cookies that present in the passed request object

Parameters:
objectModel -
Returns:
an array of Cookie is returned

getCookies

public static void getCookies(Map objectModel,
                              ContentHandler contentHandler)
                       throws SAXException
This method is used to write the values of all the cookies in the resulting XML tree The structure that will be added to the XML tree will be
 <cookies>
   <cookie>
     <name>......</name>
     <value>.....</value>
     <comment>...</comment>
     <domain>....</domain>
     <maxage>....</maxage>
     <path>......</path>
     <secure>....</secure>
     <version>...</version>
   </cookie>
   <cookie>
     ...
   </cookie>
   ...
 </cookies>
 
If the values of any of these is not present those tags will not be present.

Parameters:
objectModel -
contentHandler -
Throws:
SAXException

getCookie

public static Cookie getCookie(Map objectModel,
                               String cookieName,
                               int cookieIndex)
Method used to return a cookie object based on the name or the index that was passed If both name and index of cookie to be extracted is passed in, name will take precedence. Basic thing followed is that, when name is passed, index should be -1 and when index is passed name should null

Parameters:
objectModel -
cookieName - Name of the cookie which is to be found and returned back
cookieIndex - Index of the cookie which is to be found and returned
Returns:
cookie object is returned

getCookie

public static void getCookie(Map objectModel,
                             String cookieName,
                             int cookieIndex,
                             ContentHandler contentHandler)
                      throws SAXException
This method is used to find a cookie by it's name or index and place it in the XML resulting tree The xml structure that will be inserted will be,
 <cookie>
     <name>......</name>
     <value>.....</value>
     <comment>...</comment>
     <domain>....</domain>
     <maxage>....</maxage>
     <path>......</path>
     <secure>....</secure>
     <version>...</version>
 </cookie>
 

Parameters:
objectModel -
cookieName - name of the cookie which is to be found
cookieIndex - index of the cookie which is to be found
contentHandler -
Throws:
SAXException

getComment

public static String getComment(Map objectModel,
                                String cookieName,
                                int cookieIndex)
Method to return the value of comment for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)

Parameters:
objectModel -
cookieName - name of the cookie whose comment is to be passed
cookieIndex - index of the cookie whose comment is to be passed
Returns:
a string is returned containing the comment of the cookie, if not found then null is returned

getDomain

public static String getDomain(Map objectModel,
                               String cookieName,
                               int cookieIndex)
Method to return the value of domain for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)

Parameters:
objectModel -
cookieName - name of the cookie whose domain is to be passed
cookieIndex - index of the cookie whose domain is to be passed
Returns:
a string is returned containing the domain of the cookie, if not found then null is returned

getMaxAge

public static String getMaxAge(Map objectModel,
                               String cookieName,
                               int cookieIndex)
Method to return the value of maxage for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)

Parameters:
objectModel -
cookieName - name of the cookie whose maxage is to be passed
cookieIndex - index of the cookie whose maxage is to be passed
Returns:
a string is returned containing the maxage of the cookie, if not found then null is returned

getName

public static String getName(Map objectModel,
                             String cookieName,
                             int cookieIndex)
Method to return the value of name for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)

Parameters:
objectModel -
cookieName - name of the cookie whose name is to be passed
cookieIndex - index of the cookie whose name is to be passed
Returns:
a string is returned containing the name of the cookie, if not found then null is returned

getPath

public static String getPath(Map objectModel,
                             String cookieName,
                             int cookieIndex)
Method to return the value of path for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)

Parameters:
objectModel -
cookieName - name of the cookie whose path is to be passed
cookieIndex - index of the cookie whose path is to be passed
Returns:
a string is returned containing the path of the cookie, if not found then null is returned

getSecure

public static String getSecure(Map objectModel,
                               String cookieName,
                               int cookieIndex)
Method to return the value of secure property for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)

Parameters:
objectModel -
cookieName - name of the cookie whose secure property is to be passed
cookieIndex - index of the cookie whose secure property is to be passed
Returns:
a string is returned containing the secure property of the cookie, if not found then null is returned

getValue

public static String getValue(Map objectModel,
                              String cookieName,
                              int cookieIndex)
Method to return the value for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)

Parameters:
objectModel -
cookieName - name of the cookie whose value is to be passed
cookieIndex - index of the cookie whose value
Returns:
a string is returned containing the value of the cookie, if not found then null is returned

getVersion

public static String getVersion(Map objectModel,
                                String cookieName,
                                int cookieIndex)
Method to return the version of comment for a particular cookie based on it's name or index Rule for passing name and index of the cookie remains same as specified in previous method(s)

Parameters:
objectModel -
cookieName - name of the cookie whose version is to be passed
cookieIndex - index of the cookie whose version is to be passed
Returns:
a string is returned containing the version of the cookie, if not found then null is returned


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