本文整理汇总了Java中com.gargoylesoftware.htmlunit.WebResponseData类的典型用法代码示例。如果您正苦于以下问题:Java WebResponseData类的具体用法?Java WebResponseData怎么用?Java WebResponseData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebResponseData类属于com.gargoylesoftware.htmlunit包,在下文中一共展示了WebResponseData类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: webResponseData
import com.gargoylesoftware.htmlunit.WebResponseData; //导入依赖的package包/类
private WebResponseData webResponseData() throws IOException {
List<NameValuePair> responseHeaders = responseHeaders();
int statusCode = (this.response.getRedirectedUrl() != null ?
HttpStatus.MOVED_PERMANENTLY.value() : this.response.getStatus());
String statusMessage = statusMessage(statusCode);
return new WebResponseData(this.response.getContentAsByteArray(), statusCode, statusMessage, responseHeaders);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:MockWebResponseBuilder.java
示例2: setUp
import com.gargoylesoftware.htmlunit.WebResponseData; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
request = new WebRequest(new URL("http://localhost/"));
WebResponseData data = new WebResponseData("".getBytes("UTF-8"), 200, "", Collections.<NameValuePair> emptyList());
expectedResponse = new WebResponse(data, request, 100L);
webConnection = new DelegatingWebConnection(defaultConnection,
new DelegateWebConnection(matcher1, connection1), new DelegateWebConnection(matcher2, connection2));
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:DelegatingWebConnectionTests.java
示例3: handleGenericException
import com.gargoylesoftware.htmlunit.WebResponseData; //导入依赖的package包/类
private void handleGenericException(int statusCode, Throwable t) {
WebResponseData webResponseData = new WebResponseData(
ExceptionUtils.getFullStackTrace(t).getBytes(), statusCode, ExceptionUtils.getMessage(t),
null);
WebResponse webResponse = new WebResponse(webResponseData, null, 0);
for (SiteCrawlerAction sca : actions) {
sca.handleError(statusCode, location, urlFrom.get(location), webResponse);
}
}
开发者ID:forcedotcom,项目名称:SiteCrawler,代码行数:10,代码来源:ProcessPage.java
示例4: createPage
import com.gargoylesoftware.htmlunit.WebResponseData; //导入依赖的package包/类
@Override
public Page createPage(WebResponse webResponse, WebWindow webWindow)
throws IOException {
String content = webResponse.getContentAsString();
content = content.replaceAll(host, InetAddress.getLocalHost()
.getHostAddress()
+ ":" + Configuration.getInstance().getPort());
return super.createPage(new WebResponse(new WebResponseData(content
.getBytes(), webResponse.getStatusCode(), webResponse
.getStatusMessage(), webResponse.getResponseHeaders()),
webResponse.getWebRequest(), webResponse.getLoadTime()),
webWindow);
}
开发者ID:vetsin,项目名称:SamlSnort,代码行数:14,代码来源:TestRunner.java
示例5: build
import com.gargoylesoftware.htmlunit.WebResponseData; //导入依赖的package包/类
public WebResponse build() throws IOException {
WebResponseData webResponseData = webResponseData();
long endTime = System.currentTimeMillis();
return new WebResponse(webResponseData, webRequest, endTime - startTime);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:MockWebResponseBuilder.java
注:本文中的com.gargoylesoftware.htmlunit.WebResponseData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论