Class ServerCookies

java.lang.Object
org.apache.tomcat.util.http.ServerCookies

public class ServerCookies extends Object
This class is not thread-safe.
  • Constructor Details

    • ServerCookies

      public ServerCookies(int initialSize)
      Creates a new ServerCookies instance with the specified initial array size.
      Parameters:
      initialSize - the initial capacity for the cookies array
  • Method Details

    • addCookie

      public ServerCookie addCookie()
      Register a new, initialized cookie. Cookies are recycled, and most of the time an existing ServerCookie object is returned. The caller can set the name/value and attributes for the cookie.
      Returns:
      the new cookie
    • getCookie

      public ServerCookie getCookie(int idx)
      Returns the cookie at the specified index.
      Parameters:
      idx - the index of the cookie
      Returns:
      the cookie at the specified index
    • getCookieCount

      public int getCookieCount()
      Returns the number of cookies currently stored.
      Returns:
      the cookie count
    • setLimit

      public void setLimit(int limit)
      Sets the maximum number of cookies that can be stored.
      Parameters:
      limit - the maximum number of cookies, or -1 for no limit
    • recycle

      public void recycle()
      Recycles all stored cookies and resets the cookie count to zero.