本文整理了Java中org.vertx.java.core.http.HttpClient.close()
方法的一些代码示例,展示了HttpClient.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.close()
方法的具体详情如下:
包路径:org.vertx.java.core.http.HttpClient
类名称:HttpClient
方法名:close
[英]Close the HTTP client. This will cause any pooled HTTP connections to be closed.
[中]关闭HTTP客户端。这将导致关闭所有池HTTP连接。
代码示例来源:origin: vert-x/mod-lang-php
/**
* Closes the client.
*/
public void close(Env env) {
client.close();
}
代码示例来源:origin: io.vertx/mod-rxvertx
/** Convenience wrapper */
public void close() {
this.core.close();
}
代码示例来源:origin: io.vertx/vertx-platform
protected void end(boolean ok) {
client.close();
result = ok;
latch.countDown();
}
代码示例来源:origin: io.vertx/vertx-platform
protected void handleRedirect(HttpClientResponse resp) {
// follow redirects
String location = resp.headers().get("location");
if (location == null) {
log.error("HTTP redirect with no location header");
} else {
URI redirectURI;
try {
redirectURI = new URI(location);
client.close();
client = null;
int redirectPort = redirectURI.getPort();
if (redirectPort == -1) {
redirectPort = 80;
}
// Use raw values from location header
String uri = redirectURI.getRawPath();
String query = redirectURI.getRawQuery();
if (query != null) {
uri = uri + "?" + query; // Include query in URL
}
createClient(redirectURI.getScheme(), redirectURI.getHost(), redirectPort);
makeRequest(redirectURI.getScheme(), redirectURI.getHost(), redirectPort, uri);
} catch (URISyntaxException e) {
log.error("Invalid redirect URI: " + location);
}
}
}
代码示例来源:origin: jboss-fuse/fabric8
@Override
public void handle(Throwable throwable) {
if(throwable instanceof TimeoutException || throwable instanceof ConnectTimeoutException) {
request.response().setStatusCode(504);
request.response().end();
finalClient.close();
} else {
request.response().setStatusCode(500);
request.response().end();
finalClient.close();
LOG.error("Unhandled exception", throwable);
}
}
});
代码示例来源:origin: jboss-fuse/fabric8
@Override
public void handle(Throwable throwable) {
if(throwable instanceof TimeoutException || throwable instanceof ConnectTimeoutException) {
request.response().setStatusCode(504);
request.response().end();
finalClient.close();
} else {
request.response().setStatusCode(500);
request.response().end();
LOG.error("Unhandled exception", throwable);
finalClient.close();
}
}
});
代码示例来源:origin: io.fabric8/gateway-apiman
if (serviceResponse!=null) {
final HttpClient finalClient = (HttpClient) serviceResponse.getAttribute("finalClient");
finalClient.close();
内容来源于网络,如有侵权,请联系作者删除!