本文整理了Java中org.eclipse.jetty.client.HttpClient.isStarted()
方法的一些代码示例,展示了HttpClient.isStarted()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.isStarted()
方法的具体详情如下:
包路径:org.eclipse.jetty.client.HttpClient
类名称:HttpClient
方法名:isStarted
暂无
代码示例来源:origin: spring-projects/spring-framework
@Override
public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri,
Function<? super ClientHttpRequest, Mono<Void>> requestCallback) {
if (!uri.isAbsolute()) {
return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri));
}
if (!this.httpClient.isStarted()) {
try {
this.httpClient.start();
}
catch (Exception ex) {
return Mono.error(ex);
}
}
JettyClientHttpRequest clientHttpRequest = new JettyClientHttpRequest(
this.httpClient.newRequest(uri).method(method.toString()), this.bufferFactory);
return requestCallback.apply(clientHttpRequest).then(Mono.from(
clientHttpRequest.getReactiveRequest().response((response, chunks) -> {
Flux<DataBuffer> content = Flux.from(chunks).map(this::toDataBuffer);
return Mono.just(new JettyClientHttpResponse(response, content));
})));
}
代码示例来源:origin: org.springframework/spring-web
@Override
public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri,
Function<? super ClientHttpRequest, Mono<Void>> requestCallback) {
if (!uri.isAbsolute()) {
return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri));
}
if (!this.httpClient.isStarted()) {
try {
this.httpClient.start();
}
catch (Exception ex) {
return Mono.error(ex);
}
}
JettyClientHttpRequest clientHttpRequest = new JettyClientHttpRequest(
this.httpClient.newRequest(uri).method(method.toString()), this.bufferFactory);
return requestCallback.apply(clientHttpRequest).then(Mono.from(
clientHttpRequest.getReactiveRequest().response((response, chunks) -> {
Flux<DataBuffer> content = Flux.from(chunks).map(this::toDataBuffer);
return Mono.just(new JettyClientHttpResponse(response, content));
})));
}
代码示例来源:origin: resteasy/Resteasy
public JettyClientEngine(final HttpClient client) {
if (!client.isStarted()) {
try {
client.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
this.client = client;
}
代码示例来源:origin: NationalSecurityAgency/lemongrenade
public static boolean isConnected() {
if(client == null) {
return false;
}
return client.isStarted();
}
代码示例来源:origin: org.eclipse.smarthome.io/org.eclipse.smarthome.io.net
private static void startHttpClient(HttpClient client) {
if (!client.isStarted()) {
try {
client.start();
} catch (Exception e) {
logger.warn("Cannot start HttpClient!", e);
}
}
}
代码示例来源:origin: org.eclipse.smarthome.ui/org.eclipse.smarthome.ui
BlockingProxyServlet(ProxyServletService service) {
super();
this.service = service;
if (!httpClient.isStarted()) {
try {
httpClient.start();
} catch (Exception e) {
logger.warn("Cannot start HttpClient!", e);
}
}
}
代码示例来源:origin: openhab/openhab-core
BlockingProxyServlet(ProxyServletService service) {
super();
this.service = service;
if (!httpClient.isStarted()) {
try {
httpClient.start();
} catch (Exception e) {
logger.warn("Cannot start HttpClient!", e);
}
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-client
/**
* @param byteBufferPool the {@link ByteBufferPool} of this {@link HttpClient}
*/
public void setByteBufferPool(ByteBufferPool byteBufferPool)
{
if (isStarted())
LOG.warn("Calling setByteBufferPool() while started is deprecated");
updateBean(this.byteBufferPool, byteBufferPool);
this.byteBufferPool = byteBufferPool;
}
代码示例来源:origin: org.eclipse.jetty/jetty-client
/**
* @param executor the {@link Executor} of this {@link HttpClient}
*/
public void setExecutor(Executor executor)
{
if (isStarted())
LOG.warn("Calling setExecutor() while started is deprecated");
updateBean(this.executor, executor);
this.executor = executor;
}
代码示例来源:origin: org.eclipse.jetty/jetty-client
/**
* @param scheduler the {@link Scheduler} of this {@link HttpClient}
*/
public void setScheduler(Scheduler scheduler)
{
if (isStarted())
LOG.warn("Calling setScheduler() while started is deprecated");
updateBean(this.scheduler, scheduler);
this.scheduler = scheduler;
}
代码示例来源:origin: org.eclipse.jetty/jetty-client
/**
* @param resolver the {@link SocketAddressResolver} of this {@link HttpClient}
*/
public void setSocketAddressResolver(SocketAddressResolver resolver)
{
if (isStarted())
LOG.warn("Calling setSocketAddressResolver() while started is deprecated");
updateBean(this.resolver, resolver);
this.resolver = resolver;
}
代码示例来源:origin: openhab/openhab-core
/**
* This is a special case where the httpClient (jetty) is created due to the need for certificate pinning.
* If ceritificate pinning is needed, please refer to {@code TrustManagerProvider}. The http client is
* created, used and then shutdown immediately after use. There is little reason to cache the client/ connections
* because oauth requests are short; and it may take hours/ days before the next request is needed.
*
* @param tokenUrl access token url
* @return http client. This http client
* @throws OAuthException If any exception is thrown while starting the http client.
* @see TrustManagerProvider
*/
private HttpClient createHttpClient(String tokenUrl) throws OAuthException {
HttpClient httpClient = httpClientFactory.createHttpClient(HTTP_CLIENT_CONSUMER_NAME, tokenUrl);
if (!httpClient.isStarted()) {
try {
AccessController.doPrivileged((PrivilegedExceptionAction<@Nullable Void>) () -> {
httpClient.start();
return null;
});
} catch (Exception e) {
throw new OAuthException("Exception while starting httpClient, tokenUrl: " + tokenUrl, e);
}
}
return httpClient;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public void returnIdleConnection(AbstractHttpConnection connection)
{
// TODO work out the real idle time;
long idleForMs = connection.getEndPoint() != null ? connection.getEndPoint().getMaxIdleTime() : -1;
connection.onIdleExpired(idleForMs);
boolean startConnection = false;
boolean remove = false;
synchronized (this)
{
_idleConnections.remove(connection);
_connections.remove(connection);
if (_exchanges.isEmpty())
remove=_client.isRemoveIdleDestinations() && ( _cookies==null || _cookies.isEmpty() ) &&_connections.isEmpty() && _idleConnections.isEmpty();
else if (_client.isStarted())
startConnection = true;
}
if (startConnection)
startNewConnection();
if (remove)
_client.removeDestination(this);
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
if (!_exchanges.isEmpty() && _client.isStarted())
startConnection = true;
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
if (!_client.isStarted())
return;
if (_exchanges.isEmpty())
remove=_client.isRemoveIdleDestinations() && ( _cookies==null || _cookies.isEmpty() ) &&_connections.isEmpty() && _idleConnections.isEmpty();
else if (_client.isStarted())
startConnection = true;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web
@Override
public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri,
Function<? super ClientHttpRequest, Mono<Void>> requestCallback) {
if (!uri.isAbsolute()) {
return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri));
}
if (!this.httpClient.isStarted()) {
try {
this.httpClient.start();
}
catch (Exception ex) {
return Mono.error(ex);
}
}
JettyClientHttpRequest clientHttpRequest = new JettyClientHttpRequest(
this.httpClient.newRequest(uri).method(method.toString()), this.bufferFactory);
return requestCallback.apply(clientHttpRequest).then(Mono.from(
clientHttpRequest.getReactiveRequest().response((response, chunks) -> {
Flux<DataBuffer> content = Flux.from(chunks).map(this::toDataBuffer);
return Mono.just(new JettyClientHttpResponse(response, content));
})));
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri,
Function<? super ClientHttpRequest, Mono<Void>> requestCallback) {
if (!uri.isAbsolute()) {
return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri));
}
if (!this.httpClient.isStarted()) {
try {
this.httpClient.start();
}
catch (Exception ex) {
return Mono.error(ex);
}
}
JettyClientHttpRequest clientHttpRequest = new JettyClientHttpRequest(
this.httpClient.newRequest(uri).method(method.toString()), this.bufferFactory);
return requestCallback.apply(clientHttpRequest).then(Mono.from(
clientHttpRequest.getReactiveRequest().response((response, chunks) -> {
Flux<DataBuffer> content = Flux.from(chunks).map(this::toDataBuffer);
return Mono.just(new JettyClientHttpResponse(response, content));
})));
}
代码示例来源:origin: jpos/jPOS-EE
while(!httpClient.isStarted() && !httpClient.isFailed()) {
Thread.sleep(100);
内容来源于网络,如有侵权,请联系作者删除!