本文整理了Java中org.mozilla.zest.core.v1.ZestRequest.getUrl()
方法的一些代码示例,展示了ZestRequest.getUrl()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZestRequest.getUrl()
方法的具体详情如下:
包路径:org.mozilla.zest.core.v1.ZestRequest
类名称:ZestRequest
方法名:getUrl
[英]Gets the url.
[中]获取url。
代码示例来源:origin: mozilla/zest
@Override
public void setPrefix(String oldPrefix, String newPrefix) throws MalformedURLException {
if (this.getUrl() != null && this.getUrl().toString().startsWith(oldPrefix)) {
String urlStr = newPrefix + getUrl().toString().substring(oldPrefix.length());
this.setUrl(new URL(urlStr));
} else {
throw new IllegalArgumentException(
"Request url " + getUrl() + " does not start with " + oldPrefix);
}
}
代码示例来源:origin: mozilla/zest
assertThat(deserialisedRequest.getUrl()).isEqualTo(url);
assertThat(deserialisedRequest.getUrlToken()).isEqualTo(urlToken);
assertThat(deserialisedRequest.getMethod()).isEqualTo(method);
代码示例来源:origin: mozilla/zest
/**
* Tells whether or not the {@link ZestRuntime#getLastRequest() last request} matches {@link
* #getProtocol() the protocol} set.
*/
@Override
public boolean isTrue(ZestRuntime runtime) {
if (protocol == null) {
return false;
}
ZestRequest request = runtime.getLastRequest();
if (request == null) {
return false;
}
URL url = request.getUrl();
if (url == null) {
return false;
}
return protocol.equalsIgnoreCase(url.getProtocol());
}
代码示例来源:origin: mozilla/zest
@Override
public boolean isTrue(ZestRuntime runtime) {
ZestRequest req = runtime.getLastRequest();
if (req == null) {
return false;
}
String url = req.getUrl().toString();
boolean inc = false;
if (this.includePatterns == null) {
this.initPatterns();
}
for (Pattern pattern : includePatterns) {
if (pattern.matcher(url).find()) {
inc = true;
break;
}
}
if (!inc) {
// Not explicitly included
return false;
}
for (Pattern pattern : excludePatterns) {
if (pattern.matcher(url).find()) {
// explicitly excluded
return false;
}
}
// Included and not excluded
return true;
}
代码示例来源:origin: mozilla/zest
/**
* Sets the standard variables for a request.
*
* @param request the new standard variables
*/
@Override
public void setStandardVariables(ZestRequest request) {
if (request != null) {
if (request.getUrl() != null) {
this.setVariable(ZestVariables.REQUEST_URL, request.getUrl().toString());
}
this.setVariable(ZestVariables.REQUEST_HEADER, request.getHeaders());
this.setVariable(ZestVariables.REQUEST_METHOD, request.getMethod());
this.setVariable(ZestVariables.REQUEST_BODY, request.getData());
}
}
代码示例来源:origin: mozilla/zest
@Override
public void setStandardVariables(ZestRequest request) {
if (request != null) {
if (request.getUrl() != null) {
this.setVariable(ZestVariables.REQUEST_URL, request.getUrl().toString());
}
this.setVariable(ZestVariables.REQUEST_HEADER, request.getHeaders());
this.setVariable(ZestVariables.REQUEST_METHOD, request.getMethod());
this.setVariable(ZestVariables.REQUEST_BODY, request.getData());
}
}
代码示例来源:origin: mozilla/zest
ZestRequest req = (ZestRequest) stmt;
printIndent(indent, stmt.getIndex());
System.out.println(req.getMethod() + " " + req.getUrl());
if (req.getHeaders() != null && req.getHeaders().length() > 0) {
printIndent(indent + 1);
代码示例来源:origin: mozilla/zest
assertThat(request.getTimestamp()).isCloseTo(System.currentTimeMillis(), byLessThan(2000L));
assertThat(request.getMethod()).isEqualTo(method);
assertThat(request.getUrl()).isEqualTo(url);
assertThat(request.getHeaders()).isEqualTo(headers);
assertThat(request.getData()).isEqualTo(data);
代码示例来源:origin: mozilla/zest
@Override
public ZestResponse send(ZestRequest req) throws IOException {
HttpMethod method;
URI uri = new URI(req.getUrl().toString(), false);
this.debug(req.getMethod() + " : " + req.getUrl());
code = httpclient.executeMethod(method);
req.getUrl(),
responseHeader,
responseBody,
代码示例来源:origin: mozilla/zest
this.lastRequest = ((ZestRequest) stmt).deepCopy();
this.lastRequest.replaceTokens(this.variables);
this.debug(this.lastRequest.getMethod() + " : " + this.lastRequest.getUrl());
this.lastResponse = send(this.lastRequest);
代码示例来源:origin: mozilla/zest
req2.replaceTokens(tokens);
assertEquals("http://www.example.com/app/DEFG", req2.getUrl().toString());
assertEquals("Set-Cookie: test=GHI", req2.getHeaders());
assertEquals("test=JKL&user=12JKL34", req2.getData());
内容来源于网络,如有侵权,请联系作者删除!