本文整理汇总了Java中org.apache.http.cookie.SetCookie.setVersion方法的典型用法代码示例。如果您正苦于以下问题:Java SetCookie.setVersion方法的具体用法?Java SetCookie.setVersion怎么用?Java SetCookie.setVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.cookie.SetCookie
的用法示例。
在下文中一共展示了SetCookie.setVersion方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
/**
* Parse cookie version attribute.
*/
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (value == null) {
throw new MalformedCookieException(
"Missing value for version attribute");
}
int version = -1;
try {
version = Integer.parseInt(value);
} catch (NumberFormatException e) {
version = -1;
}
if (version < 0) {
throw new MalformedCookieException("Invalid cookie version.");
}
cookie.setVersion(version);
}
示例2: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (value == null) {
throw new MalformedCookieException("Missing value for version attribute");
}
if (value.trim().length() == 0) {
throw new MalformedCookieException("Blank value for version attribute");
}
try {
cookie.setVersion(Integer.parseInt(value));
} catch (NumberFormatException e) {
throw new MalformedCookieException("Invalid version: "
+ e.getMessage());
}
}
示例3: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
/**
* Parse cookie version attribute.
*/
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (value == null) {
throw new MalformedCookieException(
"Missing value for version attribute");
}
int version = -1;
try {
version = Integer.parseInt(value);
} catch (final NumberFormatException e) {
version = -1;
}
if (version < 0) {
throw new MalformedCookieException("Invalid cookie version.");
}
cookie.setVersion(version);
}
示例4: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (value == null) {
throw new MalformedCookieException("Missing value for version attribute");
}
if (value.trim().length() == 0) {
throw new MalformedCookieException("Blank value for version attribute");
}
try {
cookie.setVersion(Integer.parseInt(value));
} catch (final NumberFormatException e) {
throw new MalformedCookieException("Invalid version: "
+ e.getMessage());
}
}
示例5: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
/**
* Parse cookie version attribute.
*/
@Override
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (value == null) {
throw new MalformedCookieException("Missing value for version attribute");
}
int version = 0;
try {
version = Integer.parseInt(value);
} catch (final NumberFormatException e) {
// Just ignore invalid versions
}
cookie.setVersion(version);
}
示例6: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
/**
* Parse cookie version attribute.
*/
@Override
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (value == null) {
throw new MalformedCookieException(
"Missing value for version attribute");
}
int version = -1;
try {
version = Integer.parseInt(value);
} catch (final NumberFormatException e) {
version = -1;
}
if (version < 0) {
throw new MalformedCookieException("Invalid cookie version.");
}
cookie.setVersion(version);
}
示例7: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
@Override
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (value == null) {
throw new MalformedCookieException("Missing value for version attribute");
}
if (value.trim().isEmpty()) {
throw new MalformedCookieException("Blank value for version attribute");
}
try {
cookie.setVersion(Integer.parseInt(value));
} catch (final NumberFormatException e) {
throw new MalformedCookieException("Invalid version: "
+ e.getMessage());
}
}
示例8: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (value == null) {
throw new MalformedCookieException("Missing value for version attribute");
}
if (value.trim().length() == 0) {
throw new MalformedCookieException("Blank value for version attribute");
}
try {
cookie.setVersion(Integer.parseInt(value));
} catch (NumberFormatException e) {
throw new MalformedCookieException("Invalid version: "
+ e.getMessage());
}
}
示例9: parse
import org.apache.http.cookie.SetCookie; //导入方法依赖的package包/类
/**
* Parse cookie version attribute.
*/
public void parse(final SetCookie cookie, final String value)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (value == null) {
throw new MalformedCookieException("Missing value for version attribute");
}
int version = 0;
try {
version = Integer.parseInt(value);
} catch (final NumberFormatException e) {
// Just ignore invalid versions
}
cookie.setVersion(version);
}