下面列出了java.net.HttpCookie#isHttpOnly ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.isEmpty())
return value;
JavaNetHttpCookieAccess access =
SharedSecrets.getJavaNetHttpCookieAccess();
StringJoiner retValue = new StringJoiner(","); // RFC 2965, comma separated
List<HttpCookie> cookies = access.parse(value);
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (!cookie.isHttpOnly())
retValue.add(access.header(cookie));
}
return retValue.toString();
}
return value;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
JavaNetHttpCookieAccess access =
SharedSecrets.getJavaNetHttpCookieAccess();
StringJoiner retValue = new StringJoiner(","); // RFC 2965, comma separated
List<HttpCookie> cookies = access.parse(value);
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (!cookie.isHttpOnly())
retValue.add(access.header(cookie));
}
return retValue.toString();
}
return value;
}
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}
TestHttpCookie httpOnly(int index, boolean b) {
HttpCookie cookie = cookies.get(index);
if (cookie == null || b != cookie.isHttpOnly()) {
raiseError("HttpOnly", String.valueOf(cookie.isHttpOnly()), String.valueOf(b));
}
return this;
}
/**
* Returns a filtered version of the given headers value.
*
* Note: The implementation currently only filters out HttpOnly cookies
* from Set-Cookie and Set-Cookie2 headers.
*/
private String filterHeaderField(String name, String value) {
if (value == null)
return null;
if (SET_COOKIE.equalsIgnoreCase(name) ||
SET_COOKIE2.equalsIgnoreCase(name)) {
// Filtering only if there is a cookie handler. [Assumption: the
// cookie handler will store/retrieve the HttpOnly cookies]
if (cookieHandler == null || value.length() == 0)
return value;
sun.misc.JavaNetHttpCookieAccess access =
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
StringBuilder retValue = new StringBuilder();
List<HttpCookie> cookies = access.parse(value);
boolean multipleCookies = false;
for (HttpCookie cookie : cookies) {
// skip HttpOnly cookies
if (cookie.isHttpOnly())
continue;
if (multipleCookies)
retValue.append(','); // RFC 2965, comma separated
retValue.append(access.header(cookie));
multipleCookies = true;
}
return retValue.length() == 0 ? "" : retValue.toString();
}
return value;
}