org.apache.tomcat.util.http

## Class Cookies

- java.lang.Object
- - org.apache.tomcat.util.http.Cookies

    public final class Cookies
    extends Object

A collection of cookies - reusable and tuned for server side performance. Based on RFC2965 ( and 2109 ) This class is not synchronized.

Author:
  Costin Manolache, kevin seguin

### Field Summary

Fields
`static int` `INITIAL_SIZE`
`protected static StringManager` `sm`

### Constructor Summary

Constructors
Constructor and Description
`Cookies(MimeHeaders headers)` Construct a new cookie collection, that will extract the information from headers.

### Method Summary

Methods
`ServerCookie` `getCookie(int idx)`
`int` `getCookieCount()`
`protected void` `processCookieHeader(byte[] bytes, int off, int len)` Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
`void` `processCookies(MimeHeaders headers)` Add all Cookie found in the headers of a request.
`void` `recycle()` Recycle.
`String` `toString()` EXPENSIVE!!!

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### sm

    protected static final StringManager sm

#### INITIAL_SIZE

    public static final int INITIAL_SIZE

See Also:
  Constant Field Values

### Constructor Detail

#### Cookies

    public Cookies(MimeHeaders headers)

Construct a new cookie collection, that will extract the information from headers.

Parameters:
  `headers` - Cookies are lazy-evaluated and will extract the information from the provided headers.

### Method Detail

#### recycle

    public void recycle()

Recycle.

#### toString

    public String toString()

EXPENSIVE!!! only for debugging.

Overrides:
  `toString` in class `Object`

#### getCookie

    public ServerCookie getCookie(int idx)

#### getCookieCount

    public int getCookieCount()

#### processCookies

    public void processCookies(MimeHeaders headers)

Add all Cookie found in the headers of a request.

#### processCookieHeader

    protected final void processCookieHeader(byte[] bytes,
                           int off,
                           int len)

Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK