本文整理了Java中com.gargoylesoftware.htmlunit.WebConnection.getResponse()
方法的一些代码示例,展示了WebConnection.getResponse()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebConnection.getResponse()
方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebConnection
类名称:WebConnection
方法名:getResponse
[英]Submits a request and retrieves a response.
[中]提交请求并检索响应。
代码示例来源: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: spring-projects/spring-framework
@Before
public void setup() throws Exception {
when(this.connection.getResponse(any(WebRequest.class))).thenThrow(new IOException(""));
}
代码示例来源:origin: spring-projects/spring-framework
private WebResponse createResponse(WebClient client, WebRequest request) throws IOException {
return client.getWebConnection().getResponse(request);
}
代码示例来源: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: 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: 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.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;
}
代码示例来源:origin: org.jenkins-ci/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: net.sourceforge.htmlunit/htmlunit
/**
* Calls the wrapped webconnection and save the received response.
* {@inheritDoc}
*/
@Override
public WebResponse getResponse(final WebRequest request) throws IOException {
WebResponse response = wrappedWebConnection_.getResponse(request);
if (isUncompressJavaScript() && isJavaScript(response.getContentType())) {
response = uncompressJavaScript(response);
}
saveResponse(response, request);
return response;
}
代码示例来源:origin: HtmlUnit/htmlunit
/**
* Calls the wrapped webconnection and save the received response.
* {@inheritDoc}
*/
@Override
public WebResponse getResponse(final WebRequest request) throws IOException {
WebResponse response = wrappedWebConnection_.getResponse(request);
if (isUncompressJavaScript() && isJavaScript(response.getContentType())) {
response = uncompressJavaScript(response);
}
saveResponse(response, request);
return response;
}
代码示例来源:origin: jenkinsci/subversion-plugin
private FreeStyleBuild sendCommitTrigger(FreeStyleProject p, boolean includeRevision) throws Exception {
String repoUUID = "71c3de6d-444a-0410-be80-ed276b4c234a";
WebClient wc = r.createWebClient();
WebRequest wr = new WebRequest(new URL(r.getURL() + "subversion/" + repoUUID + "/notifyCommit"), HttpMethod.POST);
wr.setRequestBody("A trunk/hudson/test-projects/trivial-ant/build.xml");
wr.setAdditionalHeader("Content-Type", "text/plain;charset=UTF-8");
if (includeRevision) {
wr.setAdditionalHeader("X-Hudson-Subversion-Revision", "13000");
}
WebConnection conn = wc.getWebConnection();
WebResponse resp = conn.getResponse(wr);
assertTrue(r.isGoodHttpStatus(resp.getStatusCode()));
Thread.sleep(1000);
r.waitUntilNoActivity();
FreeStyleBuild b = p.getLastBuild();
assertNotNull(b);
r.assertBuildStatus(Result.SUCCESS,b);
return b;
}
内容来源于网络,如有侵权,请联系作者删除!