Class Cookies

java.lang.Object
com.oorian.html.Cookies

public class Cookies extends Object
Manages HTTP cookies for an Oorian page session.

This class provides convenient access to request cookies and methods for creating new cookies on the response. Cookie values are refreshed on each AJAX request to stay synchronized with the client.

Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Method Details

    • getAll

      public final List<OorianCookie> getAll()
      Returns all cookies from the current request.
      Returns:
      A list of all cookies.
    • get

      public final OorianCookie get(String name)
      Returns the cookie with the specified name, or null if not found.
      Parameters:
      name - The cookie name.
      Returns:
      The matching cookie, or null if no cookie with that name exists.
    • get

      public final OorianCookie get(String name, String defaultValue)
      Returns the cookie with the specified name, creating one with the default value if not found.
      Parameters:
      name - The cookie name.
      defaultValue - The value to use if the cookie does not exist.
      Returns:
      The existing cookie, or a newly created cookie with the default value.
    • addCookie

      public final OorianCookie addCookie(OorianCookie cookie)
      Adds a pre-configured cookie to the response.
      Parameters:
      cookie - The cookie to add.
      Returns:
      The cookie that was added.
    • addCookie

      public final OorianCookie addCookie(String name, String value)
      Creates and adds a secure, HTTP-only cookie with the specified name and value.
      Parameters:
      name - The cookie name.
      value - The cookie value.
      Returns:
      The newly created cookie.