MCPcopy Create free account
hub / github.com/apache/tomcat / convertCookies

Method convertCookies

java/org/apache/catalina/connector/Request.java:2918–2954  ·  view source on GitHub ↗

Converts the parsed cookies (parsing the Cookie headers first if they have not been parsed) into Cookie objects.

()

Source from the content-addressed store, hash-verified

2916 * Converts the parsed cookies (parsing the Cookie headers first if they have not been parsed) into Cookie objects.
2917 */
2918 protected void convertCookies() {
2919 if (cookiesConverted) {
2920 return;
2921 }
2922
2923 cookiesConverted = true;
2924
2925 parseCookies();
2926
2927 ServerCookies serverCookies = coyoteRequest.getCookies();
2928
2929 int count = serverCookies.getCookieCount();
2930 if (count <= 0) {
2931 return;
2932 }
2933
2934 cookies = new Cookie[count];
2935
2936 int idx = 0;
2937 for (int i = 0; i < count; i++) {
2938 ServerCookie scookie = serverCookies.getCookie(i);
2939 try {
2940 // We must unescape the '\\' escape character
2941 Cookie cookie = new Cookie(scookie.getName().toString(), null);
2942 scookie.getValue().getByteChunk().setCharset(getCookieProcessor().getCharset());
2943 cookie.setValue(unescape(scookie.getValue().toString()));
2944 cookies[idx++] = cookie;
2945 } catch (IllegalArgumentException ignore) {
2946 // Ignore bad cookie
2947 }
2948 }
2949 if (idx < count) {
2950 Cookie[] ncookies = new Cookie[idx];
2951 System.arraycopy(cookies, 0, ncookies, 0, idx);
2952 cookies = ncookies;
2953 }
2954 }
2955
2956
2957 /**

Callers 2

addCookieMethod · 0.95
getCookiesMethod · 0.95

Calls 13

parseCookiesMethod · 0.95
getCookieCountMethod · 0.95
getCookieMethod · 0.95
getNameMethod · 0.95
getValueMethod · 0.95
getCookieProcessorMethod · 0.95
setValueMethod · 0.95
unescapeMethod · 0.95
getByteChunkMethod · 0.80
getCookiesMethod · 0.65
toStringMethod · 0.65
setCharsetMethod · 0.65

Tested by

no test coverage detected