Package org.apache.tomcat.util.http
Class ServerCookies
- java.lang.Object
-
- org.apache.tomcat.util.http.ServerCookies
-
public class ServerCookies extends java.lang.ObjectThis 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 ServerCookieaddCookie()Register a new, initialized cookie.ServerCookiegetCookie(int idx)Returns the cookie at the specified index.intgetCookieCount()Returns the number of cookies currently stored.voidrecycle()Recycles all stored cookies and resets the cookie count to zero.voidsetLimit(int limit)Sets the maximum number of cookies that can be stored.
-
-
-
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.
-
-