Class ServerCookies


  • public class ServerCookies
    extends java.lang.Object
    This class is not thread-safe.
    • Constructor Summary

      Constructors 
      Constructor Description
      ServerCookies​(int initialSize)
      Creates a new ServerCookies instance with the specified initial array size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ServerCookie addCookie()
      Register a new, initialized cookie.
      ServerCookie getCookie​(int idx)
      Returns the cookie at the specified index.
      int getCookieCount()
      Returns the number of cookies currently stored.
      void recycle()
      Recycles all stored cookies and resets the cookie count to zero.
      void setLimit​(int limit)
      Sets the maximum number of cookies that can be stored.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • 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.