Class ServerCookies
java.lang.Object
org.apache.tomcat.util.http.ServerCookies
This class is not thread-safe.
-
Constructor Summary
ConstructorsConstructorDescriptionServerCookies(int initialSize) Creates a new ServerCookies instance with the specified initial array size. -
Method Summary
Modifier and TypeMethodDescriptionRegister a new, initialized cookie.getCookie(int idx) Returns the cookie at the specified index.intReturns 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.
-
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
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
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.
-