Schnittstelle CookieParser

Alle Superschnittstellen:
Iterable<String>, ValueParser
Alle bekannten Implementierungsklassen:
DefaultCookieParser

public interface CookieParser extends ValueParser
CookieParser is an interface to a utility to to get and set values of Cookies on the Client Browser. You can use CookieParser to convert Cookie values to various types or to set Bean values with setParameters(). Servlet Spec for more information on Cookies.

Use set() or unset() to Create or Destroy Cookies.

NOTE: The name= portion of a name=value pair may be converted to lowercase or uppercase when the object is initialized and when new data is added. This behaviour is determined by the url.case.folding property in TurbineResources.properties. Adding a name/value pair may overwrite existing name=value pairs if the names match:

 CookieParser cp = data.getCookies();
 cp.add("ERROR",1);
 cp.add("eRrOr",2);
 int result = cp.getInt("ERROR");
 
In the above example, result is 2.
Version:
$Id$
Autor:
Ilkka Priha, Leon Messerschmidt, Thomas Vandahl
  • Felddetails

  • Methodendetails

    • getRequest

      HttpServletRequest getRequest()
      Gets the servlet request.
      Gibt zurück:
      the servlet request object or null.
    • setData

      void setData(HttpServletRequest request, HttpServletResponse response)
      Sets the servlet request and response to be parsed. All previous cookies will be cleared.
      Parameter:
      request - the servlet request object.
      response - the servlet response object
    • set

      void set(String name, String value)
      Set a cookie that will be stored on the client for the duration of the session.
      Parameter:
      name - The name of the cookie
      value - The value of the cooking
    • set

      void set(String name, String value, int seconds_age)
      Set a persistent cookie on the client that will expire after a maximum age (given in seconds).
      Parameter:
      name - A String for the name
      value - A String for the value
      seconds_age - An int for the age in seconds
    • unset

      void unset(String name)
      Remove a previously set cookie from the client machine.
      Parameter:
      name - the name of the cooking to unset
    • isValid

      boolean isValid()