本文整理了Java中org.mozilla.zest.core.v1.ZestCookie
类的一些代码示例,展示了ZestCookie
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestCookie
类的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestCookie
类名称:ZestCookie
暂无
代码示例来源:origin: mozilla/zest
public void addCookie(
String domain, String name, String value, String path, Date expiry, boolean secure) {
this.addCookie(new ZestCookie(domain, name, value, path, expiry, secure));
}
代码示例来源:origin: mozilla/zest
/** @deprecated (0.14.0) Use {@link #getZestCookies()} instead. */
@Deprecated
public List<Cookie> getCookies() {
List<Cookie> cookies = new ArrayList<>();
for (ZestCookie cookie : this.cookies) {
cookies.add(
new Cookie(
cookie.getDomain(),
cookie.getName(),
cookie.getValue(),
cookie.getPath(),
cookie.getExpiryDate(),
cookie.isSecure()));
}
return cookies;
}
代码示例来源:origin: mozilla/zest
/**
* Replace tokens.
*
* @param tokens the tokens
*/
public void replaceTokens(ZestVariables tokens) {
if (this.urlToken != null) {
this.setUrlToken(tokens.replaceInString(this.urlToken, true));
try {
this.setUrl(new URL(this.getUrlToken()));
} catch (MalformedURLException e) {
// Ignore
}
} else if (this.url != null) {
try {
this.setUrl(new URL(tokens.replaceInString(this.url.toString(), true)));
} catch (MalformedURLException e) {
// Ignore
}
}
this.setMethod(tokens.replaceInString(this.getMethod(), false));
this.setHeaders(tokens.replaceInString(this.getHeaders(), false));
this.setData(tokens.replaceInString(this.getData(), false));
for (ZestCookie cookie : this.cookies) {
cookie.setDomain(tokens.replaceInString(cookie.getDomain(), false));
cookie.setName(tokens.replaceInString(cookie.getName(), false));
cookie.setValue(tokens.replaceInString(cookie.getValue(), false));
cookie.setPath(tokens.replaceInString(cookie.getPath(), false));
}
}
代码示例来源:origin: mozilla/zest
req.setData("test={{token3}}&user=12{{token3}}34");
req.addCookie(
new ZestCookie(
"{{token}}.{{token3}}",
"12{{token3}}34",
assertEquals("Set-Cookie: test=GHI", req2.getHeaders());
assertEquals("test=JKL&user=12JKL34", req2.getData());
assertEquals("ABC.JKL", req2.getZestCookies().get(0).getDomain());
assertEquals("12JKL34", req2.getZestCookies().get(0).getName());
assertEquals("56GHI78", req2.getZestCookies().get(0).getValue());
assertEquals("/DEFGA/GHIB", req2.getZestCookies().get(0).getPath());
代码示例来源:origin: mozilla/zest
@Override
public ZestRequest deepCopy() {
ZestRequest zr = new ZestRequest(this.getIndex());
zr.setUrl(this.url);
zr.setUrlToken(this.urlToken);
zr.setData(this.data);
zr.setMethod(this.method);
zr.setHeaders(this.headers);
zr.setFollowRedirects(this.followRedirects);
zr.setTimestamp(this.timestamp);
if (this.getResponse() != null) {
zr.setResponse(this.getResponse().deepCopy());
}
for (ZestAssertion zt : this.getAssertions()) {
zr.addAssertion((ZestAssertion) zt.deepCopy());
}
for (ZestCookie cookie : this.cookies) {
zr.addCookie(
new ZestCookie(
cookie.getDomain(),
cookie.getName(),
cookie.getValue(),
cookie.getPath(),
cookie.getExpiryDate(),
cookie.isSecure()));
}
zr.setEnabled(this.isEnabled());
return zr;
}
代码示例来源:origin: mozilla/zest
req.setTimestamp(Instant.now().toEpochMilli());
req.addCookie(
new ZestCookie(
"{{token}}.{{token3}}",
"12{{token3}}34",
assertTrue(cookie.getDomain().equals(cookie2.getDomain()));
assertTrue(cookie.getName().equals(cookie2.getName()));
assertTrue(cookie.getValue().equals(cookie2.getValue()));
assertTrue(cookie.getPath().equals(cookie2.getPath()));
assertTrue(cookie.getExpiryDate().equals(cookie2.getExpiryDate()));
assertTrue(cookie.isSecure() == cookie2.isSecure());
代码示例来源:origin: mozilla/zest
Cookie cookie =
new Cookie(
zestCookie.getDomain(),
zestCookie.getName(),
zestCookie.getValue(),
zestCookie.getPath(),
zestCookie.getExpiryDate(),
zestCookie.isSecure());
httpclient.getState().addCookie(cookie);
内容来源于网络,如有侵权,请联系作者删除!