本文整理了Java中com.gargoylesoftware.htmlunit.WebConnection
类的一些代码示例,展示了WebConnection
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebConnection
类的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebConnection
类名称:WebConnection
[英]An object which handles the actual communication portion of page retrieval/submission.
[中]处理页面检索/提交的实际通信部分的对象。
代码示例来源:origin: spring-projects/spring-framework
@Override
public WebResponse getResponse(WebRequest request) throws IOException {
for (DelegateWebConnection connection : this.connections) {
if (connection.getMatcher().matches(request)) {
return connection.getDelegate().getResponse(request);
}
}
return this.defaultConnection.getResponse(request);
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* {@inheritDoc}
* The default behavior of this method is to return {@link WebConnection#close()} on the wrapped connection object.
*/
@Override
public void close() throws Exception {
wrappedWebConnection_.close();
}
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* {@inheritDoc}
* The default behavior of this method is to return {@link WebConnection#close()} on the wrapped connection object.
*/
@Override
public void close() throws Exception {
wrappedWebConnection_.close();
}
}
代码示例来源:origin: spring-projects/spring-framework
@Before
public void setup() throws Exception {
when(this.connection.getResponse(any(WebRequest.class))).thenThrow(new IOException(""));
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
webConnection_.close();
代码示例来源:origin: spring-projects/spring-framework
private WebResponse createResponse(WebClient client, WebRequest request) throws IOException {
return client.getWebConnection().getResponse(request);
}
代码示例来源:origin: HtmlUnit/htmlunit
webConnection_.close();
代码示例来源:origin: spring-projects/spring-framework
private WebResponse getResponse(WebConnection connection, String url) throws IOException {
return connection.getResponse(new WebRequest(new URL(url)));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void getResponseDefault() throws Exception {
when(defaultConnection.getResponse(request)).thenReturn(expectedResponse);
WebResponse response = webConnection.getResponse(request);
assertThat(response, sameInstance(expectedResponse));
verify(matcher1).matches(request);
verify(matcher2).matches(request);
verifyNoMoreInteractions(connection1, connection2);
verify(defaultConnection).getResponse(request);
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void getResponseSecondMatches() throws Exception {
when(matcher2.matches(request)).thenReturn(true);
when(connection2.getResponse(request)).thenReturn(expectedResponse);
WebResponse response = webConnection.getResponse(request);
assertThat(response, sameInstance(expectedResponse));
verify(matcher1).matches(request);
verify(matcher2).matches(request);
verifyNoMoreInteractions(connection1, defaultConnection);
verify(connection2).getResponse(request);
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void getResponseAllMatches() throws Exception {
when(matcher1.matches(request)).thenReturn(true);
when(connection1.getResponse(request)).thenReturn(expectedResponse);
WebResponse response = webConnection.getResponse(request);
assertThat(response, sameInstance(expectedResponse));
verify(matcher1).matches(request);
verifyNoMoreInteractions(matcher2, connection2, defaultConnection);
verify(connection1).getResponse(request);
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* {@inheritDoc}
* The default behavior of this method is to return {@link WebConnection#getResponse(WebRequest)}
* on the wrapped connection object.
*/
@Override
public WebResponse getResponse(final WebRequest request) throws IOException {
return wrappedWebConnection_.getResponse(request);
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* {@inheritDoc}
* The default behavior of this method is to return {@link WebConnection#getResponse(WebRequest)}
* on the wrapped connection object.
*/
@Override
public WebResponse getResponse(final WebRequest request) throws IOException {
return wrappedWebConnection_.getResponse(request);
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* {@inheritDoc}
* The default behavior of this method is to return getResponse() on the wrapped connection object.
*/
public WebResponse getResponse(final WebRequestSettings settings) throws IOException {
return wrappedWebConnection_.getResponse(settings);
}
代码示例来源:origin: org.jenkins-ci/htmlunit
/**
* {@inheritDoc}
* The default behavior of this method is to return getResponse() on the wrapped connection object.
*/
public WebResponse getResponse(final WebRequestSettings settings) throws IOException {
return wrappedWebConnection_.getResponse(settings);
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* {@inheritDoc}
* The default behavior of this method is to return getResponse() on the wrapped connection object.
*/
public WebResponse getResponse(final WebRequestSettings settings) throws IOException {
return wrappedWebConnection_.getResponse(settings);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test
@Override
public WebResponse getResponse(WebRequest request) throws IOException {
for (DelegateWebConnection connection : this.connections) {
if (connection.getMatcher().matches(request)) {
return connection.getDelegate().getResponse(request);
}
}
return this.defaultConnection.getResponse(request);
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public WebResponse getResponse(WebRequest request) throws IOException {
for (DelegateWebConnection connection : this.connections) {
if (connection.getMatcher().matches(request)) {
return connection.getDelegate().getResponse(request);
}
}
return this.defaultConnection.getResponse(request);
}
代码示例来源:origin: net.disy.htmlunit/htmlunit
/**
* Calls the wrapped webconnection and save the received response.
* {@inheritDoc}
*/
@Override
public WebResponse getResponse(final WebRequestSettings settings) throws IOException {
final WebResponse response = wrappedWebConnection_.getResponse(settings);
saveResponse(response, settings);
return response;
}
代码示例来源:origin: org.jvnet.hudson/htmlunit
/**
* Calls the wrapped webconnection and save the received response.
* {@inheritDoc}
*/
@Override
public WebResponse getResponse(final WebRequestSettings settings) throws IOException {
final WebResponse response = wrappedWebConnection_.getResponse(settings);
saveResponse(response, settings);
return response;
}
内容来源于网络,如有侵权,请联系作者删除!