use of javax.servlet.http.Cookie in project tomcat by apache.
the class TestCookieProcessorGeneration method v1ValueUTF8.
@Test
public void v1ValueUTF8() {
String value = "⌀";
Cookie cookie = new Cookie("foo", value);
cookie.setVersion(1);
doTest(cookie, (String) null, "foo=" + value);
}
use of javax.servlet.http.Cookie in project tomcat by apache.
the class TestCookieProcessorGeneration method v0ValueContainsBackslash.
@Test
public void v0ValueContainsBackslash() {
Cookie cookie = new Cookie("foo", "a\\b");
doTestDefaults(cookie, "foo=\"a\\\\b\"; Version=1", null);
doTestAllowSeparators(cookie, "foo=a\\b", null);
}
use of javax.servlet.http.Cookie in project tomcat by apache.
the class TestCookieProcessorGeneration method v1ValueContainsComma.
@Test
public void v1ValueContainsComma() {
Cookie cookie = new Cookie("foo", "a,b");
cookie.setVersion(1);
doTest(cookie, "foo=\"a,b\"; Version=1", null);
}
use of javax.servlet.http.Cookie in project tomcat by apache.
the class TestCookieProcessorGeneration method v1ValueContainsBackslashAndQuote.
@Test
public void v1ValueContainsBackslashAndQuote() {
Cookie cookie = new Cookie("foo", "a\"b\\c");
cookie.setVersion(1);
doTest(cookie, "foo=\"a\\\"b\\\\c\"; Version=1", null);
}
use of javax.servlet.http.Cookie in project tomcat by apache.
the class ApplicationPushBuilder method generateCookieHeader.
private static String generateCookieHeader(List<Cookie> cookies, CookieProcessor cookieProcessor) {
StringBuilder result = new StringBuilder();
boolean first = true;
for (Cookie cookie : cookies) {
if (first) {
first = false;
} else {
result.append(';');
}
// The cookie header value generated by the CookieProcessor was
// originally intended for the Set-Cookie header on the response.
// However, if passed a Cookie with just a name and value set it
// will generate an appropriate header for the Cookie header on the
// pushed request.
result.append(cookieProcessor.generateHeader(cookie));
}
return result.toString();
}
Aggregations