本文整理了Java中org.apache.http.cookie.Cookie.getVersion()
方法的一些代码示例,展示了Cookie.getVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cookie.getVersion()
方法的具体详情如下:
包路径:org.apache.http.cookie.Cookie
类名称:Cookie
方法名:getVersion
[英]Returns the version of the cookie specification to which this cookie conforms.
[中]返回此cookie符合的cookie规范的版本。
代码示例来源:origin: robovm/robovm
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (cookie.getVersion() < 0) {
throw new MalformedCookieException("Cookie version may not be negative");
}
}
代码示例来源:origin: robovm/robovm
public List<Header> formatCookies(final List<Cookie> cookies) {
if (cookies == null) {
throw new IllegalArgumentException("List of cookie may not be null");
}
int version = Integer.MAX_VALUE;
for (Cookie cookie: cookies) {
if (cookie.getVersion() < version) {
version = cookie.getVersion();
}
}
if (version > 0) {
return getStrict().formatCookies(cookies);
} else {
return getCompat().formatCookies(cookies);
}
}
代码示例来源:origin: robovm/robovm
public boolean match(final Cookie cookie, final CookieOrigin origin) {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (origin == null) {
throw new IllegalArgumentException("Cookie origin may not be null");
}
if (cookie.getVersion() > 0) {
return getStrict().match(cookie, origin);
} else {
return getCompat().match(cookie, origin);
}
}
代码示例来源:origin: robovm/robovm
/**
* Don't log the cookie's value; that's potentially sensitive information.
*/
private String cookieToString(Cookie cookie) {
return cookie.getClass().getSimpleName()
+ "[version=" + cookie.getVersion()
+ ",name=" + cookie.getName()
+ ",domain=" + cookie.getDomain()
+ ",path=" + cookie.getPath()
+ ",expiry=" + cookie.getExpiryDate()
+ "]";
}
// END android-added
代码示例来源:origin: robovm/robovm
public void validate(
final Cookie cookie,
final CookieOrigin origin) throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (origin == null) {
throw new IllegalArgumentException("Cookie origin may not be null");
}
if (cookie.getVersion() > 0) {
getStrict().validate(cookie, origin);
} else {
getCompat().validate(cookie, origin);
}
}
代码示例来源:origin: robovm/robovm
private List<Header> doFormatManyHeaders(final List<Cookie> cookies) {
List<Header> headers = new ArrayList<Header>(cookies.size());
for (Cookie cookie : cookies) {
int version = cookie.getVersion();
CharArrayBuffer buffer = new CharArrayBuffer(40);
buffer.append("Cookie: ");
buffer.append("$Version=");
buffer.append(Integer.toString(version));
buffer.append("; ");
formatCookieAsVer(buffer, cookie, version);
headers.add(new BufferedHeader(buffer));
}
return headers;
}
代码示例来源:origin: robovm/robovm
private List<Header> doFormatOneHeader(final List<Cookie> cookies) {
int version = Integer.MAX_VALUE;
// Pick the lowest common denominator
for (Cookie cookie : cookies) {
if (cookie.getVersion() < version) {
version = cookie.getVersion();
}
}
CharArrayBuffer buffer = new CharArrayBuffer(40 * cookies.size());
buffer.append(SM.COOKIE);
buffer.append(": ");
buffer.append("$Version=");
buffer.append(Integer.toString(version));
for (Cookie cooky : cookies) {
buffer.append("; ");
Cookie cookie = cooky;
formatCookieAsVer(buffer, cookie, version);
}
List<Header> headers = new ArrayList<Header>(1);
headers.add(new BufferedHeader(buffer));
return headers;
}
代码示例来源:origin: robovm/robovm
boolean needVersionHeader = false;
for (Cookie cookie : matchedCookies) {
if (ver != cookie.getVersion()) {
needVersionHeader = true;
代码示例来源:origin: MobiVM/robovm
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (cookie.getVersion() < 0) {
throw new MalformedCookieException("Cookie version may not be negative");
}
}
代码示例来源:origin: com.gluonhq/robovm-rt
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (cookie.getVersion() < 0) {
throw new MalformedCookieException("Cookie version may not be negative");
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (cookie.getVersion() < 0) {
throw new MalformedCookieException("Cookie version may not be negative");
}
}
代码示例来源:origin: FlexoVM/flexovm
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (cookie.getVersion() < 0) {
throw new MalformedCookieException("Cookie version may not be negative");
}
}
代码示例来源:origin: ibinti/bugvm
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (cookie.getVersion() < 0) {
throw new CookieRestrictionViolationException("Cookie version may not be negative");
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (cookie.getVersion() < 0) {
throw new CookieRestrictionViolationException("Cookie version may not be negative");
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (cookie.getVersion() < 0) {
throw new CookieRestrictionViolationException("Cookie version may not be negative");
}
}
代码示例来源:origin: com.hynnet/httpclient
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (cookie.getVersion() < 0) {
throw new CookieRestrictionViolationException("Cookie version may not be negative");
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (cookie.getVersion() < 0) {
throw new CookieRestrictionViolationException("Cookie version may not be negative");
}
}
代码示例来源:origin: Nextdoor/bender
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (cookie.getVersion() < 0) {
throw new CookieRestrictionViolationException("Cookie version may not be negative");
}
}
代码示例来源:origin: org.apache.httpcomponents/httpclient-android
@Override
public void validate(final Cookie cookie, final CookieOrigin origin)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (cookie.getVersion() < 0) {
throw new CookieRestrictionViolationException("Cookie version may not be negative");
}
}
代码示例来源:origin: MobiVM/robovm
/**
* Don't log the cookie's value; that's potentially sensitive information.
*/
private String cookieToString(Cookie cookie) {
return cookie.getClass().getSimpleName()
+ "[version=" + cookie.getVersion()
+ ",name=" + cookie.getName()
+ ",domain=" + cookie.getDomain()
+ ",path=" + cookie.getPath()
+ ",expiry=" + cookie.getExpiryDate()
+ "]";
}
// END android-added
内容来源于网络,如有侵权,请联系作者删除!