org.apache.tomcat.util.http

Class Cookies


public final class Cookies
extends java.lang.Object

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

Authors:
Costin Manolache
kevin seguin

Field Summary

static int
INITIAL_SIZE

Constructor Summary

Cookies()
Construct a new uninitialized cookie collection.
Cookies(MimeHeaders headers)
Construct a new cookie collection, that will extract the information from headers.

Method Summary

ServerCookie
addCookie()
Register a new, unitialized cookie.
static boolean
equals(String s, b[] , int start, int end)
static int
findDelim1(bytes[] , int off, int end)
static int
findDelim2(bytes[] , int off, int end)
ServerCookie
getCookie(int idx)
int
getCookieCount()
static int
indexOf(bytes[] , int off, int end, byte qq)
static int
indexOf(bytes[] , int off, int end, char qq)
void
log(String s)
void
processCookies(MimeHeaders headers)
Add all Cookie found in the headers of a request.
void
recycle()
Recycle.
void
setHeaders(MimeHeaders headers)
Set the headers from which cookies will be pulled.
static int
skipSpaces(bytes[] , int off, int end)
String
toString()
EXPENSIVE!!! only for debugging.

Field Details

INITIAL_SIZE

public static final int INITIAL_SIZE

Field Value:
4

Constructor Details

Cookies

public Cookies()


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 Details

addCookie

public ServerCookie addCookie()
Register a new, unitialized 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


equals

public static boolean equals(String s,
                             b[] ,
                             int start,
                             int end)


findDelim1

public static int findDelim1(bytes[] ,
                             int off,
                             int end)


findDelim2

public static int findDelim2(bytes[] ,
                             int off,
                             int end)


getCookie

public ServerCookie getCookie(int idx)


getCookieCount

public int getCookieCount()


indexOf

public static int indexOf(bytes[] ,
                          int off,
                          int end,
                          byte qq)


indexOf

public static int indexOf(bytes[] ,
                          int off,
                          int end,
                          char qq)


log

public void log(String s)


processCookies

public void processCookies(MimeHeaders headers)
Add all Cookie found in the headers of a request.


recycle

public void recycle()
Recycle.


setHeaders

public void setHeaders(MimeHeaders headers)
Set the headers from which cookies will be pulled. This has the side effect of recycling the object.

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


skipSpaces

public static int skipSpaces(bytes[] ,
                             int off,
                             int end)


toString

public String toString()
EXPENSIVE!!! only for debugging.


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.