MCPcopy Index your code
hub / github.com/apache/tomcat / addCookie

Method addCookie

java/org/apache/tomcat/util/http/ServerCookies.java:50–69  ·  view source on GitHub ↗

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. @return the new cookie

()

Source from the content-addressed store, hash-verified

48 * @return the new cookie
49 */
50 public ServerCookie addCookie() {
51 if (limit > -1 && cookieCount >= limit) {
52 throw new IllegalArgumentException(sm.getString("cookies.maxCountFail", Integer.valueOf(limit)));
53 }
54
55 if (cookieCount >= serverCookies.length) {
56 int newSize = limit > -1 ? Math.min(2 * cookieCount, limit) : 2 * cookieCount;
57 ServerCookie[] scookiesTmp = new ServerCookie[newSize];
58 System.arraycopy(serverCookies, 0, scookiesTmp, 0, cookieCount);
59 serverCookies = scookiesTmp;
60 }
61
62 ServerCookie c = serverCookies[cookieCount];
63 if (c == null) {
64 c = new ServerCookie();
65 serverCookies[cookieCount] = c;
66 }
67 cookieCount++;
68 return c;
69 }
70
71
72 /**

Callers

nothing calls this directly

Calls 3

getStringMethod · 0.65
valueOfMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected