You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2019/07/14 12:13:28 UTC
[httpcomponents-client] branch httpcore-5.0b8-upgrade created (now
84e55d6)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a change to branch httpcore-5.0b8-upgrade
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git.
at 84e55d6 Renamed Http2 to H2 (no functional changes)
This branch includes the following new commits:
new 35a9046 Upgraded HttpCore to version 5.0-beta8
new eb73921 Deprecated HttpClient functionality now provided out of HttpCore
new 84e55d6 Renamed Http2 to H2 (no functional changes)
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[httpcomponents-client] 01/03: Upgraded HttpCore to version
5.0-beta8
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch httpcore-5.0b8-upgrade
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 35a904666bd5c538ce7e05e5d3ebbe8db32daac0
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Jun 6 16:23:43 2019 +0200
Upgraded HttpCore to version 5.0-beta8
---
.../org/apache/hc/client5/http/fluent/Request.java | 5 +-
.../async/AbstractSimpleServerExchangeHandler.java | 2 +-
.../async/AuthenticatingAsyncDecorator.java | 2 +-
.../async/AbstractHttp1IntegrationTestBase.java | 8 ++--
.../AbstractHttpAsyncClientAuthentication.java | 8 ++--
.../async/AbstractHttpAsyncFundamentalsTest.java | 2 +-
.../async/AbstractHttpAsyncRedirectsTest.java | 10 ++--
.../testing/async/AbstractIntegrationTestBase.java | 6 +--
.../testing/async/AbstractServerTestBase.java | 6 +--
.../hc/client5/testing/async/TestHttp1Async.java | 4 +-
.../TestHttp1AsyncStatefulConnManagement.java | 4 +-
.../async/TestHttp1ClientAuthentication.java | 4 +-
.../testing/async/TestHttpAsyncMinimal.java | 10 ++--
.../testing/sync/TestMalformedServerResponse.java | 6 +--
.../client5/testing/sync/TestSSLSocketFactory.java | 53 +++++-----------------
.../http/async/methods/AsyncRequestBuilder.java | 2 +-
.../http/async/methods/SimpleRequestProducer.java | 2 +-
.../client5/http/entity/UrlEncodedFormEntity.java | 18 ++++----
.../impl/async/AbstractHttpAsyncClientBase.java | 7 ---
.../http/impl/async/CloseableHttpAsyncClient.java | 4 --
.../http/impl/async/Http2AsyncClientBuilder.java | 1 +
.../async/Http2AsyncClientEventHandlerFactory.java | 16 +++----
.../http/impl/async/HttpAsyncClientBuilder.java | 11 +++--
.../async/HttpAsyncClientEventHandlerFactory.java | 18 ++++----
.../client5/http/impl/async/HttpAsyncClients.java | 12 ++---
.../http/impl/async/LoggingExceptionCallback.java | 48 ++++++++++++++++++++
.../client5/http/impl/async/LoggingIOSession.java | 10 ++--
.../http/impl/async/MinimalHttp2AsyncClient.java | 1 +
.../http/impl/async/MinimalHttpAsyncClient.java | 1 +
.../hc/client5/http/impl/classic/ProxyClient.java | 6 +--
.../impl/io/DefaultHttpResponseParserFactory.java | 4 +-
.../io/DefaultManagedHttpClientConnection.java | 4 +-
.../http/impl/io/LenientHttpResponseParser.java | 10 ++--
.../io/ManagedHttpClientConnectionFactory.java | 12 ++---
.../http/ssl/AbstractClientTlsStrategy.java | 6 ++-
.../http/ssl/SSLConnectionSocketFactory.java | 27 ++---------
.../examples/AsyncClientFullDuplexExchange.java | 8 ++--
.../http/examples/AsyncClientHttp1Pipelining.java | 4 +-
.../AsyncClientHttp2FullDuplexExchange.java | 4 +-
.../http/examples/AsyncClientHttp2ServerPush.java | 5 --
.../examples/AsyncClientHttpExchangeStreaming.java | 5 --
.../hc/client5/http/examples/AsyncQuickStart.java | 5 --
.../client5/http/examples/ClientConfiguration.java | 8 ++--
.../examples/ReactiveClientFullDuplexExchange.java | 6 +--
pom.xml | 2 +-
45 files changed, 188 insertions(+), 209 deletions(-)
diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
index 2d47327..850ef6b 100644
--- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
+++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
@@ -323,8 +323,9 @@ public class Request {
for (final NameValuePair param : formParams) {
paramList.add(param);
}
- final ContentType contentType = ContentType.create(URLEncodedUtils.CONTENT_TYPE, charset);
- final String s = URLEncodedUtils.format(paramList, charset);
+ final ContentType contentType = charset != null ?
+ ContentType.APPLICATION_FORM_URLENCODED.withCharset(charset) : ContentType.APPLICATION_FORM_URLENCODED;
+ final String s = URLEncodedUtils.format(paramList, contentType.getCharset());
return bodyString(s, contentType);
}
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java
index 650cceb..24635ac 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AbstractSimpleServerExchangeHandler.java
@@ -38,12 +38,12 @@ import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
import org.apache.hc.core5.http.nio.AsyncRequestConsumer;
import org.apache.hc.core5.http.nio.AsyncServerRequestHandler;
-import org.apache.hc.core5.http.nio.BasicResponseProducer;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityProducer;
import org.apache.hc.core5.http.nio.support.AbstractAsyncRequesterConsumer;
import org.apache.hc.core5.http.nio.support.AbstractServerExchangeHandler;
+import org.apache.hc.core5.http.nio.support.BasicResponseProducer;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http.protocol.HttpCoreContext;
diff --git a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
index 030bc26..ec55db3 100644
--- a/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
+++ b/httpclient5-testing/src/main/java/org/apache/hc/client5/testing/async/AuthenticatingAsyncDecorator.java
@@ -45,11 +45,11 @@ import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
import org.apache.hc.core5.http.message.BasicHttpResponse;
import org.apache.hc.core5.http.nio.AsyncResponseProducer;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
-import org.apache.hc.core5.http.nio.BasicResponseProducer;
import org.apache.hc.core5.http.nio.CapacityChannel;
import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.ResponseChannel;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
+import org.apache.hc.core5.http.nio.support.BasicResponseProducer;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.net.URIAuthority;
import org.apache.hc.core5.util.Args;
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
index 074f4e3..424b719 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttp1IntegrationTestBase.java
@@ -40,7 +40,7 @@ import org.apache.hc.client5.testing.SSLTestContexts;
import org.apache.hc.core5.function.Decorator;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.HttpProcessors;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
import org.apache.hc.core5.http.protocol.HttpProcessor;
@@ -109,7 +109,7 @@ public abstract class AbstractHttp1IntegrationTestBase extends AbstractServerTes
public HttpHost start(
final HttpProcessor httpProcessor,
final Decorator<AsyncServerExchangeHandler> exchangeHandlerDecorator,
- final H1Config h1Config) throws Exception {
+ final Http1Config h1Config) throws Exception {
server.start(httpProcessor, exchangeHandlerDecorator, h1Config);
final Future<ListenerEndpoint> endpointFuture = server.listen(new InetSocketAddress(0));
httpclient = clientBuilder.build();
@@ -121,12 +121,12 @@ public abstract class AbstractHttp1IntegrationTestBase extends AbstractServerTes
public HttpHost start(
final HttpProcessor httpProcessor,
- final H1Config h1Config) throws Exception {
+ final Http1Config h1Config) throws Exception {
return start(httpProcessor, null, h1Config);
}
public HttpHost start() throws Exception {
- return start(HttpProcessors.server(), H1Config.DEFAULT);
+ return start(HttpProcessors.server(), Http1Config.DEFAULT);
}
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthentication.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthentication.java
index ff5c340..ff2041f 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthentication.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthentication.java
@@ -62,7 +62,7 @@ import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.config.Lookup;
import org.apache.hc.core5.http.config.Registry;
import org.apache.hc.core5.http.config.RegistryBuilder;
@@ -72,7 +72,7 @@ import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http.protocol.HttpCoreContext;
import org.apache.hc.core5.http2.config.H2Config;
-import org.apache.hc.core5.http2.impl.Http2Processors;
+import org.apache.hc.core5.http2.impl.H2Processors;
import org.apache.hc.core5.net.URIAuthority;
import org.junit.Assert;
import org.junit.Test;
@@ -102,14 +102,14 @@ public abstract class AbstractHttpAsyncClientAuthentication<T extends CloseableH
final Decorator<AsyncServerExchangeHandler> exchangeHandlerDecorator) throws Exception {
if (protocolVersion.greaterEquals(HttpVersion.HTTP_2_0)) {
return super.start(
- Http2Processors.server(),
+ H2Processors.server(),
exchangeHandlerDecorator,
H2Config.DEFAULT);
} else {
return super.start(
HttpProcessors.server(),
exchangeHandlerDecorator,
- H1Config.DEFAULT);
+ Http1Config.DEFAULT);
}
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
index 3100812..281609e 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
@@ -47,8 +47,8 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.Message;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.nio.BasicResponseConsumer;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer;
+import org.apache.hc.core5.http.nio.support.BasicResponseConsumer;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
index 9ceafa5..9f5e722 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
@@ -57,7 +57,7 @@ import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.message.BasicHeader;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
import org.apache.hc.core5.http.protocol.HttpCoreContext;
@@ -65,7 +65,7 @@ import org.apache.hc.core5.http2.config.H2Config;
import org.apache.hc.core5.net.URIBuilder;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.reactor.ListenerEndpoint;
-import org.apache.hc.core5.testing.nio.Http2TestServer;
+import org.apache.hc.core5.testing.nio.H2TestServer;
import org.apache.hc.core5.util.TimeValue;
import org.junit.Assert;
import org.junit.Test;
@@ -84,7 +84,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
if (version.greaterEquals(HttpVersion.HTTP_2)) {
return super.start(null, H2Config.DEFAULT);
} else {
- return super.start(null, H1Config.DEFAULT);
+ return super.start(null, Http1Config.DEFAULT);
}
}
@@ -686,7 +686,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
});
final HttpHost redirectTarget = start();
- final Http2TestServer secondServer = new Http2TestServer(IOReactorConfig.DEFAULT,
+ final H2TestServer secondServer = new H2TestServer(IOReactorConfig.DEFAULT,
scheme == URIScheme.HTTPS ? SSLTestContexts.createServerSSLContext() : null);
try {
secondServer.register("/redirect/*", new Supplier<AsyncServerExchangeHandler>() {
@@ -701,7 +701,7 @@ public abstract class AbstractHttpAsyncRedirectsTest <T extends CloseableHttpAsy
if (version.greaterEquals(HttpVersion.HTTP_2)) {
secondServer.start(H2Config.DEFAULT);
} else {
- secondServer.start(H1Config.DEFAULT);
+ secondServer.start(Http1Config.DEFAULT);
}
final Future<ListenerEndpoint> endpointFuture = secondServer.listen(new InetSocketAddress(0));
final ListenerEndpoint endpoint2 = endpointFuture.get();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
index 422837b..03d9a4d 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
@@ -34,7 +34,7 @@ import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.core5.function.Decorator;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
import org.apache.hc.core5.http.protocol.HttpProcessor;
import org.apache.hc.core5.http2.config.H2Config;
@@ -75,7 +75,7 @@ public abstract class AbstractIntegrationTestBase<T extends CloseableHttpAsyncCl
public final HttpHost start(
final HttpProcessor httpProcessor,
final Decorator<AsyncServerExchangeHandler> exchangeHandlerDecorator,
- final H1Config h1Config) throws Exception {
+ final Http1Config h1Config) throws Exception {
server.start(httpProcessor, exchangeHandlerDecorator, h1Config);
final Future<ListenerEndpoint> endpointFuture = server.listen(new InetSocketAddress(0));
httpclient = createClient();
@@ -87,7 +87,7 @@ public abstract class AbstractIntegrationTestBase<T extends CloseableHttpAsyncCl
public final HttpHost start(
final HttpProcessor httpProcessor,
- final H1Config h1Config) throws Exception {
+ final Http1Config h1Config) throws Exception {
return start(httpProcessor, null, h1Config);
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractServerTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractServerTestBase.java
index 090dd68..98eea6b 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractServerTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractServerTestBase.java
@@ -32,7 +32,7 @@ import org.apache.hc.core5.function.Supplier;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
import org.apache.hc.core5.reactor.IOReactorConfig;
-import org.apache.hc.core5.testing.nio.Http2TestServer;
+import org.apache.hc.core5.testing.nio.H2TestServer;
import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
import org.junit.Rule;
@@ -53,14 +53,14 @@ public abstract class AbstractServerTestBase {
this(URIScheme.HTTP);
}
- protected Http2TestServer server;
+ protected H2TestServer server;
@Rule
public ExternalResource serverResource = new ExternalResource() {
@Override
protected void before() throws Throwable {
- server = new Http2TestServer(
+ server = new H2TestServer(
IOReactorConfig.custom()
.setSoTimeout(TIMEOUT)
.build(),
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
index 7623b64..2117f98 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.http.HeaderElements;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Rule;
@@ -114,7 +114,7 @@ public class TestHttp1Async extends AbstractHttpAsyncFundamentalsTest<CloseableH
@Override
public HttpHost start() throws Exception {
- return super.start(null, H1Config.DEFAULT);
+ return super.start(null, Http1Config.DEFAULT);
}
@Test
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
index 6411eb7..54b27d4 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
@@ -48,7 +48,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
import org.apache.hc.core5.http.protocol.BasicHttpContext;
import org.apache.hc.core5.http.protocol.HttpContext;
@@ -105,7 +105,7 @@ public class TestHttp1AsyncStatefulConnManagement extends AbstractIntegrationTes
@Override
public HttpHost start() throws Exception {
- return super.start(null, H1Config.DEFAULT);
+ return super.start(null, Http1Config.DEFAULT);
}
@Test
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ClientAuthentication.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ClientAuthentication.java
index 605ec2a..ac62f9c 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ClientAuthentication.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ClientAuthentication.java
@@ -54,7 +54,7 @@ import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.config.Lookup;
import org.apache.hc.core5.http.impl.HttpProcessors;
import org.apache.hc.core5.http.nio.AsyncServerExchangeHandler;
@@ -159,7 +159,7 @@ public class TestHttp1ClientAuthentication extends AbstractHttpAsyncClientAuthen
}
},
- H1Config.DEFAULT);
+ Http1Config.DEFAULT);
final TestCredentialsProvider credsProvider = new TestCredentialsProvider(
new UsernamePasswordCredentials("test", "test".toCharArray()));
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
index c98dc22..8bdd5b5 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
@@ -48,10 +48,10 @@ import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.Message;
import org.apache.hc.core5.http.URIScheme;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
-import org.apache.hc.core5.http.nio.BasicResponseConsumer;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer;
+import org.apache.hc.core5.http.nio.support.BasicResponseConsumer;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
import org.apache.hc.core5.reactor.IOReactorConfig;
@@ -91,10 +91,10 @@ public class TestHttpAsyncMinimal extends AbstractHttpAsyncFundamentalsTest<Mini
.build();
if (version.greaterEquals(HttpVersion.HTTP_2)) {
return HttpAsyncClients.createMinimal(
- HttpVersionPolicy.FORCE_HTTP_2, H2Config.DEFAULT, H1Config.DEFAULT, ioReactorConfig, connectionManager);
+ HttpVersionPolicy.FORCE_HTTP_2, H2Config.DEFAULT, Http1Config.DEFAULT, ioReactorConfig, connectionManager);
} else {
return HttpAsyncClients.createMinimal(
- HttpVersionPolicy.FORCE_HTTP_1, H2Config.DEFAULT, H1Config.DEFAULT, ioReactorConfig, connectionManager);
+ HttpVersionPolicy.FORCE_HTTP_1, H2Config.DEFAULT, Http1Config.DEFAULT, ioReactorConfig, connectionManager);
}
}
@@ -103,7 +103,7 @@ public class TestHttpAsyncMinimal extends AbstractHttpAsyncFundamentalsTest<Mini
if (version.greaterEquals(HttpVersion.HTTP_2)) {
return super.start(null, H2Config.DEFAULT);
} else {
- return super.start(null, H1Config.DEFAULT);
+ return super.start(null, Http1Config.DEFAULT);
}
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java
index 385adc6..93b763d 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpStatus;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
import org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnection;
@@ -54,7 +54,7 @@ public class TestMalformedServerResponse {
static class BrokenServerConnection extends DefaultBHttpServerConnection {
- public BrokenServerConnection(final H1Config h1Config) {
+ public BrokenServerConnection(final Http1Config h1Config) {
super(null, h1Config);
}
@@ -81,7 +81,7 @@ public class TestMalformedServerResponse {
@Override
public DefaultBHttpServerConnection createConnection(final Socket socket) throws IOException {
- final BrokenServerConnection conn = new BrokenServerConnection(H1Config.DEFAULT);
+ final BrokenServerConnection conn = new BrokenServerConnection(Http1Config.DEFAULT);
conn.bind(socket);
return conn;
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
index 5dcbe78..082f621 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSSLSocketFactory.java
@@ -39,7 +39,7 @@ import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
-import javax.net.ssl.SSLServerSocket;
+import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
@@ -49,9 +49,9 @@ import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
import org.apache.hc.client5.http.ssl.TrustAllStrategy;
import org.apache.hc.client5.http.ssl.TrustSelfSignedStrategy;
import org.apache.hc.client5.testing.SSLTestContexts;
+import org.apache.hc.core5.function.Callback;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.impl.bootstrap.HttpServer;
-import org.apache.hc.core5.http.impl.bootstrap.SSLServerSetupHandler;
import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
import org.apache.hc.core5.http.protocol.BasicHttpContext;
import org.apache.hc.core5.http.protocol.HttpContext;
@@ -190,11 +190,11 @@ public class TestSSLSocketFactory {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
- .setSslSetupHandler(new SSLServerSetupHandler() {
+ .setSslSetupHandler(new Callback<SSLParameters>() {
@Override
- public void initialize(final SSLServerSocket socket) throws SSLException {
- socket.setNeedClientAuth(true);
+ public void execute(final SSLParameters sslParameters) {
+ sslParameters.setNeedClientAuth(true);
}
})
@@ -302,47 +302,16 @@ public class TestSSLSocketFactory {
}
}
- @Test
- public void testTLSOnly() throws Exception {
- // @formatter:off
- this.server = ServerBootstrap.bootstrap()
- .setSslContext(SSLTestContexts.createServerSSLContext())
- .setSslSetupHandler(new SSLServerSetupHandler() {
-
- @Override
- public void initialize(final SSLServerSocket socket) throws SSLException {
- socket.setEnabledProtocols(new String[] {"TLSv1"});
- }
-
- })
- .create();
- // @formatter:on
- this.server.start();
-
- final HttpContext context = new BasicHttpContext();
- final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
- SSLTestContexts.createClientSSLContext());
- try (final Socket socket = socketFactory.createSocket(context)) {
- final InetSocketAddress remoteAddress = new InetSocketAddress("localhost", this.server.getLocalPort());
- final HttpHost target = new HttpHost("https", "localhost", this.server.getLocalPort());
- try (final SSLSocket sslSocket = (SSLSocket) socketFactory.connectSocket(TimeValue.ZERO_MILLISECONDS, socket, target, remoteAddress,
- null, context)) {
- final SSLSession sslsession = sslSocket.getSession();
- Assert.assertNotNull(sslsession);
- }
- }
- }
-
@Test(expected = IOException.class)
public void testSSLDisabledByDefault() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
- .setSslSetupHandler(new SSLServerSetupHandler() {
+ .setSslSetupHandler(new Callback<SSLParameters>() {
@Override
- public void initialize(final SSLServerSocket socket) throws SSLException {
- socket.setEnabledProtocols(new String[] {"SSLv3"});
+ public void execute(final SSLParameters sslParameters) {
+ sslParameters.setProtocols(new String[] {"SSLv3"});
}
})
@@ -393,11 +362,11 @@ public class TestSSLSocketFactory {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
- .setSslSetupHandler(new SSLServerSetupHandler() {
+ .setSslSetupHandler(new Callback<SSLParameters>() {
@Override
- public void initialize(final SSLServerSocket socket) {
- socket.setEnabledCipherSuites(new String[] {cipherSuite});
+ public void execute(final SSLParameters sslParameters) {
+ sslParameters.setProtocols(new String[] {cipherSuite});
}
})
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
index 5c9d1a9..33d5f62 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
@@ -47,9 +47,9 @@ import org.apache.hc.core5.http.message.BasicNameValuePair;
import org.apache.hc.core5.http.message.HeaderGroup;
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
import org.apache.hc.core5.http.nio.AsyncRequestProducer;
-import org.apache.hc.core5.http.nio.BasicRequestProducer;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityProducer;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
import org.apache.hc.core5.net.URIBuilder;
import org.apache.hc.core5.net.URLEncodedUtils;
import org.apache.hc.core5.util.Args;
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleRequestProducer.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleRequestProducer.java
index 4e5dc92..d6e78a5 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleRequestProducer.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleRequestProducer.java
@@ -27,9 +27,9 @@
package org.apache.hc.client5.http.async.methods;
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
-import org.apache.hc.core5.http.nio.BasicRequestProducer;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityProducer;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
import org.apache.hc.core5.util.Args;
/**
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/UrlEncodedFormEntity.java b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/UrlEncodedFormEntity.java
index c058c25..9e18a77 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/entity/UrlEncodedFormEntity.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/entity/UrlEncodedFormEntity.java
@@ -27,7 +27,6 @@
package org.apache.hc.client5.http.entity;
import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
import java.util.List;
import org.apache.hc.core5.http.ContentType;
@@ -52,17 +51,18 @@ public class UrlEncodedFormEntity extends StringEntity {
*
* @since 4.2
*/
- public UrlEncodedFormEntity (
- final Iterable <? extends NameValuePair> parameters,
- final Charset charset) {
- super(URLEncodedUtils.format(parameters,
- charset != null ? charset : StandardCharsets.ISO_8859_1),
- ContentType.create(URLEncodedUtils.CONTENT_TYPE, charset));
+ public UrlEncodedFormEntity(
+ final Iterable<? extends NameValuePair> parameters,
+ final Charset charset) {
+ super(URLEncodedUtils.format(
+ parameters,
+ charset != null ? charset : ContentType.APPLICATION_FORM_URLENCODED.getCharset()),
+ charset != null ? ContentType.APPLICATION_FORM_URLENCODED.withCharset(charset) : ContentType.APPLICATION_FORM_URLENCODED);
}
/**
* Constructs a new {@link UrlEncodedFormEntity} with the list
- * of parameters with the default encoding of {@link StandardCharsets#ISO_8859_1}
+ * of parameters with the default encoding of {@link ContentType#APPLICATION_FORM_URLENCODED}
*
* @param parameters list of name/value pairs
*/
@@ -72,7 +72,7 @@ public class UrlEncodedFormEntity extends StringEntity {
/**
* Constructs a new {@link UrlEncodedFormEntity} with the list
- * of parameters with the default encoding of {@link StandardCharsets#ISO_8859_1}
+ * of parameters with the default encoding of {@link ContentType#APPLICATION_FORM_URLENCODED}
*
* @param parameters iterable collection of name/value pairs
*
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
index 4c9be88..916bd07 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java
@@ -26,7 +26,6 @@
*/
package org.apache.hc.client5.http.impl.async;
-import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
@@ -37,7 +36,6 @@ import org.apache.hc.core5.http.nio.AsyncPushConsumer;
import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.ConnectionInitiator;
import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
-import org.apache.hc.core5.reactor.ExceptionEvent;
import org.apache.hc.core5.reactor.IOReactorStatus;
import org.apache.hc.core5.util.TimeValue;
import org.slf4j.Logger;
@@ -102,11 +100,6 @@ abstract class AbstractHttpAsyncClientBase extends CloseableHttpAsyncClient {
}
@Override
- public final List<ExceptionEvent> getExceptionLog() {
- return ioReactor.getExceptionLog();
- }
-
- @Override
public final void awaitShutdown(final TimeValue waitTime) throws InterruptedException {
ioReactor.awaitShutdown(waitTime);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
index 46bbbb8..b42f457 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/CloseableHttpAsyncClient.java
@@ -27,7 +27,6 @@
package org.apache.hc.client5.http.impl.async;
import java.io.Closeable;
-import java.util.List;
import java.util.concurrent.Future;
import org.apache.hc.client5.http.async.HttpAsyncClient;
@@ -46,7 +45,6 @@ import org.apache.hc.core5.http.nio.AsyncRequestProducer;
import org.apache.hc.core5.http.nio.AsyncResponseConsumer;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.io.CloseMode;
-import org.apache.hc.core5.reactor.ExceptionEvent;
import org.apache.hc.core5.reactor.IOReactorStatus;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.TimeValue;
@@ -63,8 +61,6 @@ public abstract class CloseableHttpAsyncClient implements HttpAsyncClient, Close
public abstract IOReactorStatus getStatus();
- public abstract List<ExceptionEvent> getExceptionLog();
-
public abstract void awaitShutdown(TimeValue waitTime) throws InterruptedException;
public abstract void initiateShutdown();
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
index 44112f6..6aa021f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
@@ -721,6 +721,7 @@ public class Http2AsyncClientBuilder {
ioReactorConfig != null ? ioReactorConfig : IOReactorConfig.DEFAULT,
threadFactory != null ? threadFactory : new DefaultThreadFactory("httpclient-dispatch", true),
null,
+ LoggingExceptionCallback.INSTANCE,
null,
new Callback<IOSession>() {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
index 15b5069..4849ba3 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
@@ -40,9 +40,9 @@ import org.apache.hc.core5.http.protocol.HttpProcessor;
import org.apache.hc.core5.http2.config.H2Config;
import org.apache.hc.core5.http2.frame.FramePrinter;
import org.apache.hc.core5.http2.frame.RawFrame;
-import org.apache.hc.core5.http2.impl.nio.ClientHttp2StreamMultiplexerFactory;
-import org.apache.hc.core5.http2.impl.nio.Http2OnlyClientProtocolNegotiator;
-import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
+import org.apache.hc.core5.http2.impl.nio.ClientH2StreamMultiplexerFactory;
+import org.apache.hc.core5.http2.impl.nio.H2OnlyClientProtocolNegotiator;
+import org.apache.hc.core5.http2.impl.nio.H2StreamListener;
import org.apache.hc.core5.reactor.IOEventHandler;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
import org.apache.hc.core5.reactor.ProtocolIOSession;
@@ -84,12 +84,12 @@ class Http2AsyncClientEventHandlerFactory implements IOEventHandlerFactory {
|| framePayloadLog.isDebugEnabled()
|| flowCtrlLog.isDebugEnabled()) {
final String id = ConnPoolSupport.getId(ioSession);
- final ClientHttp2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientHttp2StreamMultiplexerFactory(
+ final ClientH2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientH2StreamMultiplexerFactory(
httpProcessor,
exchangeHandlerFactory,
h2Config,
charCodingConfig,
- new Http2StreamListener() {
+ new H2StreamListener() {
final FramePrinter framePrinter = new FramePrinter();
@@ -173,15 +173,15 @@ class Http2AsyncClientEventHandlerFactory implements IOEventHandlerFactory {
});
final LoggingIOSession loggingIOSession = new LoggingIOSession(ioSession, id, sessionLog, wireLog);
- return new Http2OnlyClientProtocolNegotiator(loggingIOSession, http2StreamHandlerFactory, false);
+ return new H2OnlyClientProtocolNegotiator(loggingIOSession, http2StreamHandlerFactory, false);
}
- final ClientHttp2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientHttp2StreamMultiplexerFactory(
+ final ClientH2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientH2StreamMultiplexerFactory(
httpProcessor,
exchangeHandlerFactory,
h2Config,
charCodingConfig,
null);
- return new Http2OnlyClientProtocolNegotiator(ioSession, http2StreamHandlerFactory, false);
+ return new H2OnlyClientProtocolNegotiator(ioSession, http2StreamHandlerFactory, false);
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
index 2d00944..67c0f32 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
@@ -94,7 +94,7 @@ import org.apache.hc.core5.http.HttpRequestInterceptor;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpResponseInterceptor;
import org.apache.hc.core5.http.config.CharCodingConfig;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.config.Lookup;
import org.apache.hc.core5.http.config.NamedElementChain;
import org.apache.hc.core5.http.config.RegistryBuilder;
@@ -211,7 +211,7 @@ public class HttpAsyncClientBuilder {
private AsyncClientConnectionManager connManager;
private boolean connManagerShared;
private IOReactorConfig ioReactorConfig;
- private H1Config h1Config;
+ private Http1Config h1Config;
private H2Config h2Config;
private CharCodingConfig charCodingConfig;
private SchemePortResolver schemePortResolver;
@@ -271,9 +271,9 @@ public class HttpAsyncClientBuilder {
}
/**
- * Sets {@link H1Config} configuration.
+ * Sets {@link Http1Config} configuration.
*/
- public final HttpAsyncClientBuilder setH1Config(final H1Config h1Config) {
+ public final HttpAsyncClientBuilder setHttp1Config(final Http1Config h1Config) {
this.h1Config = h1Config;
return this;
}
@@ -920,7 +920,7 @@ public class HttpAsyncClientBuilder {
},
versionPolicy != null ? versionPolicy : HttpVersionPolicy.NEGOTIATE,
h2Config != null ? h2Config : H2Config.DEFAULT,
- h1Config != null ? h1Config : H1Config.DEFAULT,
+ h1Config != null ? h1Config : Http1Config.DEFAULT,
charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT,
reuseStrategyCopy);
final DefaultConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(
@@ -928,6 +928,7 @@ public class HttpAsyncClientBuilder {
ioReactorConfig != null ? ioReactorConfig : IOReactorConfig.DEFAULT,
threadFactory != null ? threadFactory : new DefaultThreadFactory("httpclient-dispatch", true),
null,
+ LoggingExceptionCallback.INSTANCE,
null,
new Callback<IOSession>() {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java
index 51028ca..c89db2a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientEventHandlerFactory.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.http.HttpConnection;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.config.CharCodingConfig;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.impl.Http1StreamListener;
import org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexerFactory;
@@ -55,9 +55,9 @@ import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
import org.apache.hc.core5.http2.frame.FramePrinter;
import org.apache.hc.core5.http2.frame.RawFrame;
-import org.apache.hc.core5.http2.impl.nio.ClientHttp2StreamMultiplexerFactory;
+import org.apache.hc.core5.http2.impl.nio.ClientH2StreamMultiplexerFactory;
import org.apache.hc.core5.http2.impl.nio.ClientHttpProtocolNegotiator;
-import org.apache.hc.core5.http2.impl.nio.Http2StreamListener;
+import org.apache.hc.core5.http2.impl.nio.H2StreamListener;
import org.apache.hc.core5.reactor.IOEventHandler;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
import org.apache.hc.core5.reactor.ProtocolIOSession;
@@ -78,7 +78,7 @@ class HttpAsyncClientEventHandlerFactory implements IOEventHandlerFactory {
private final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory;
private final HttpVersionPolicy versionPolicy;
private final H2Config h2Config;
- private final H1Config h1Config;
+ private final Http1Config h1Config;
private final CharCodingConfig charCodingConfig;
private final ConnectionReuseStrategy http1ConnectionReuseStrategy;
private final NHttpMessageParserFactory<HttpResponse> http1ResponseParserFactory;
@@ -89,14 +89,14 @@ class HttpAsyncClientEventHandlerFactory implements IOEventHandlerFactory {
final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory,
final HttpVersionPolicy versionPolicy,
final H2Config h2Config,
- final H1Config h1Config,
+ final Http1Config h1Config,
final CharCodingConfig charCodingConfig,
final ConnectionReuseStrategy connectionReuseStrategy) {
this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
this.exchangeHandlerFactory = exchangeHandlerFactory;
this.versionPolicy = versionPolicy != null ? versionPolicy : HttpVersionPolicy.NEGOTIATE;
this.h2Config = h2Config != null ? h2Config : H2Config.DEFAULT;
- this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
+ this.h1Config = h1Config != null ? h1Config : Http1Config.DEFAULT;
this.charCodingConfig = charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT;
this.http1ConnectionReuseStrategy = connectionReuseStrategy != null ? connectionReuseStrategy : DefaultConnectionReuseStrategy.INSTANCE;
this.http1ResponseParserFactory = new DefaultHttpResponseParserFactory(h1Config);
@@ -155,12 +155,12 @@ class HttpAsyncClientEventHandlerFactory implements IOEventHandlerFactory {
}
});
- final ClientHttp2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientHttp2StreamMultiplexerFactory(
+ final ClientH2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientH2StreamMultiplexerFactory(
httpProcessor,
exchangeHandlerFactory,
h2Config,
charCodingConfig,
- new Http2StreamListener() {
+ new H2StreamListener() {
final FramePrinter framePrinter = new FramePrinter();
@@ -258,7 +258,7 @@ class HttpAsyncClientEventHandlerFactory implements IOEventHandlerFactory {
http1ResponseParserFactory,
http1RequestWriterFactory,
null);
- final ClientHttp2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientHttp2StreamMultiplexerFactory(
+ final ClientH2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientH2StreamMultiplexerFactory(
httpProcessor,
exchangeHandlerFactory,
h2Config,
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
index 4c20403..83c3546 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
@@ -38,7 +38,7 @@ import org.apache.hc.core5.concurrent.DefaultThreadFactory;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.config.CharCodingConfig;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
import org.apache.hc.core5.http.nio.AsyncPushConsumer;
import org.apache.hc.core5.http.nio.HandlerFactory;
@@ -150,7 +150,7 @@ public final class HttpAsyncClients {
public static MinimalHttpAsyncClient createMinimal(
final HttpVersionPolicy versionPolicy,
final H2Config h2Config,
- final H1Config h1Config,
+ final Http1Config h1Config,
final IOReactorConfig ioReactorConfig,
final AsyncClientConnectionManager connmgr) {
final AsyncPushConsumerRegistry pushConsumerRegistry = new AsyncPushConsumerRegistry();
@@ -185,7 +185,7 @@ public final class HttpAsyncClients {
public static MinimalHttpAsyncClient createMinimal(
final HttpVersionPolicy versionPolicy,
final H2Config h2Config,
- final H1Config h1Config,
+ final Http1Config h1Config,
final IOReactorConfig ioReactorConfig) {
return createMinimal(versionPolicy, h2Config, h1Config, ioReactorConfig,
PoolingAsyncClientConnectionManagerBuilder.create().build());
@@ -196,7 +196,7 @@ public final class HttpAsyncClients {
* HTTP/1.1 and HTTP/2 message transport without advanced HTTP protocol
* functionality.
*/
- public static MinimalHttpAsyncClient createMinimal(final H2Config h2Config, final H1Config h1Config) {
+ public static MinimalHttpAsyncClient createMinimal(final H2Config h2Config, final Http1Config h1Config) {
return createMinimal(HttpVersionPolicy.NEGOTIATE, h2Config, h1Config, IOReactorConfig.DEFAULT);
}
@@ -206,7 +206,7 @@ public final class HttpAsyncClients {
* functionality.
*/
public static MinimalHttpAsyncClient createMinimal() {
- return createMinimal(H2Config.DEFAULT, H1Config.DEFAULT);
+ return createMinimal(H2Config.DEFAULT, Http1Config.DEFAULT);
}
/**
@@ -218,7 +218,7 @@ public final class HttpAsyncClients {
return createMinimal(
HttpVersionPolicy.NEGOTIATE,
H2Config.DEFAULT,
- H1Config.DEFAULT,
+ Http1Config.DEFAULT,
IOReactorConfig.DEFAULT,
connManager);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingExceptionCallback.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingExceptionCallback.java
new file mode 100644
index 0000000..911b00c
--- /dev/null
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingExceptionCallback.java
@@ -0,0 +1,48 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.client5.http.impl.async;
+
+import org.apache.hc.core5.function.Callback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class LoggingExceptionCallback implements Callback<Exception> {
+
+ static LoggingExceptionCallback INSTANCE = new LoggingExceptionCallback();
+
+ private final Logger log = LoggerFactory.getLogger("org.apache.hc.client5.http.impl.async");
+
+ private LoggingExceptionCallback() {
+ }
+
+ @Override
+ public void execute(final Exception ex) {
+ log.error(ex.getMessage(), ex);
+ }
+
+}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
index 44a27f0..a0256c8 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/LoggingIOSession.java
@@ -81,11 +81,6 @@ class LoggingIOSession implements ProtocolIOSession {
}
@Override
- public Lock lock() {
- return this.session.lock();
- }
-
- @Override
public boolean hasCommands() {
return this.session.hasCommands();
}
@@ -223,6 +218,11 @@ class LoggingIOSession implements ProtocolIOSession {
}
@Override
+ public long getLastEventTime() {
+ return this.session.getLastEventTime();
+ }
+
+ @Override
public IOEventHandler getHandler() {
return this.session.getHandler();
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
index 356355a..6f728e1 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
@@ -106,6 +106,7 @@ public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClien
reactorConfig,
workerThreadFactory,
null,
+ LoggingExceptionCallback.INSTANCE,
null,
new Callback<IOSession>() {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
index 32940e0..6ff2222 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java
@@ -116,6 +116,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
reactorConfig,
workerThreadFactory,
null,
+ LoggingExceptionCallback.INSTANCE,
null,
new Callback<IOSession>() {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
index 5088cf4..edbece2 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProxyClient.java
@@ -37,11 +37,11 @@ import org.apache.hc.client5.http.RouteInfo.TunnelType;
import org.apache.hc.client5.http.SystemDefaultDnsResolver;
import org.apache.hc.client5.http.auth.AuthExchange;
import org.apache.hc.client5.http.auth.AuthSchemeProvider;
+import org.apache.hc.client5.http.auth.AuthSchemes;
import org.apache.hc.client5.http.auth.AuthScope;
import org.apache.hc.client5.http.auth.ChallengeType;
import org.apache.hc.client5.http.auth.Credentials;
import org.apache.hc.client5.http.auth.KerberosConfig;
-import org.apache.hc.client5.http.auth.AuthSchemes;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.DefaultAuthenticationStrategy;
import org.apache.hc.client5.http.impl.TunnelRefusedException;
@@ -64,7 +64,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.config.CharCodingConfig;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.config.Lookup;
import org.apache.hc.core5.http.config.RegistryBuilder;
import org.apache.hc.core5.http.impl.DefaultConnectionReuseStrategy;
@@ -102,7 +102,7 @@ public class ProxyClient {
*/
public ProxyClient(
final HttpConnectionFactory<ManagedHttpClientConnection> connFactory,
- final H1Config h1Config,
+ final Http1Config h1Config,
final CharCodingConfig charCodingConfig,
final RequestConfig requestConfig) {
super();
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpResponseParserFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpResponseParserFactory.java
index f61eeb7..108b293 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpResponseParserFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpResponseParserFactory.java
@@ -31,7 +31,7 @@ import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpResponseFactory;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.io.DefaultClassicHttpResponseFactory;
import org.apache.hc.core5.http.io.HttpMessageParser;
import org.apache.hc.core5.http.io.HttpMessageParserFactory;
@@ -68,7 +68,7 @@ public class DefaultHttpResponseParserFactory implements HttpMessageParserFactor
}
@Override
- public HttpMessageParser<ClassicHttpResponse> create(final H1Config h1Config) {
+ public HttpMessageParser<ClassicHttpResponse> create(final Http1Config h1Config) {
return new LenientHttpResponseParser(this.lineParser, this.responseFactory, h1Config);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
index 19a4a1b..226647b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.ContentLengthStrategy;
import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection;
import org.apache.hc.core5.http.impl.io.SocketHolder;
import org.apache.hc.core5.http.io.HttpMessageParserFactory;
@@ -71,7 +71,7 @@ final class DefaultManagedHttpClientConnection
final String id,
final CharsetDecoder charDecoder,
final CharsetEncoder charEncoder,
- final H1Config h1Config,
+ final Http1Config h1Config,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/LenientHttpResponseParser.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/LenientHttpResponseParser.java
index 4a0c246..a4d617b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/LenientHttpResponseParser.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/LenientHttpResponseParser.java
@@ -32,7 +32,7 @@ import java.io.IOException;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpResponseFactory;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser;
import org.apache.hc.core5.http.message.LineParser;
import org.apache.hc.core5.util.CharArrayBuffer;
@@ -57,25 +57,25 @@ public class LenientHttpResponseParser extends DefaultHttpResponseParser {
* @param responseFactory HTTP response factory. If {@code null}
* {@link org.apache.hc.core5.http.impl.io.DefaultClassicHttpResponseFactory#INSTANCE}
* will be used.
- * @param h1Config HTTP/1.1 parameters. If {@code null}. {@link H1Config#DEFAULT} will be used.
+ * @param h1Config HTTP/1.1 parameters. If {@code null}. {@link Http1Config#DEFAULT} will be used.
*
* @since 4.3
*/
public LenientHttpResponseParser(
final LineParser lineParser,
final HttpResponseFactory<ClassicHttpResponse> responseFactory,
- final H1Config h1Config) {
+ final Http1Config h1Config) {
super(lineParser, responseFactory, h1Config);
}
/**
* Creates new instance of DefaultHttpResponseParser.
*
- * @param h1Config HTTP/1.1 parameters. If {@code null}. {@link H1Config#DEFAULT} will be used.
+ * @param h1Config HTTP/1.1 parameters. If {@code null}. {@link Http1Config#DEFAULT} will be used.
*
* @since 4.3
*/
- public LenientHttpResponseParser(final H1Config h1Config) {
+ public LenientHttpResponseParser(final Http1Config h1Config) {
this(null, null, h1Config);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/ManagedHttpClientConnectionFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/ManagedHttpClientConnectionFactory.java
index 7dd373f..63ae378 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/ManagedHttpClientConnectionFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/ManagedHttpClientConnectionFactory.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.ContentLengthStrategy;
import org.apache.hc.core5.http.config.CharCodingConfig;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
import org.apache.hc.core5.http.impl.io.DefaultHttpRequestWriterFactory;
import org.apache.hc.core5.http.io.HttpConnectionFactory;
@@ -60,7 +60,7 @@ public class ManagedHttpClientConnectionFactory implements HttpConnectionFactory
public static final ManagedHttpClientConnectionFactory INSTANCE = new ManagedHttpClientConnectionFactory();
- private final H1Config h1Config;
+ private final Http1Config h1Config;
private final CharCodingConfig charCodingConfig;
private final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory;
private final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory;
@@ -68,14 +68,14 @@ public class ManagedHttpClientConnectionFactory implements HttpConnectionFactory
private final ContentLengthStrategy outgoingContentStrategy;
public ManagedHttpClientConnectionFactory(
- final H1Config h1Config,
+ final Http1Config h1Config,
final CharCodingConfig charCodingConfig,
final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
super();
- this.h1Config = h1Config != null ? h1Config : H1Config.DEFAULT;
+ this.h1Config = h1Config != null ? h1Config : Http1Config.DEFAULT;
this.charCodingConfig = charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT;
this.requestWriterFactory = requestWriterFactory != null ? requestWriterFactory :
DefaultHttpRequestWriterFactory.INSTANCE;
@@ -88,7 +88,7 @@ public class ManagedHttpClientConnectionFactory implements HttpConnectionFactory
}
public ManagedHttpClientConnectionFactory(
- final H1Config h1Config,
+ final Http1Config h1Config,
final CharCodingConfig charCodingConfig,
final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory,
final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory) {
@@ -96,7 +96,7 @@ public class ManagedHttpClientConnectionFactory implements HttpConnectionFactory
}
public ManagedHttpClientConnectionFactory(
- final H1Config h1Config,
+ final Http1Config h1Config,
final CharCodingConfig charCodingConfig,
final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory) {
this(h1Config, charCodingConfig, null, responseParserFactory);
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
index ed694e8..239c14c 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
@@ -41,6 +41,8 @@ import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
+import org.apache.hc.core5.http.ssl.TLS;
+import org.apache.hc.core5.http.ssl.TlsCiphers;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.ssl.H2TlsSupport;
import org.apache.hc.core5.net.NamedEndpoint;
@@ -101,12 +103,12 @@ abstract class AbstractClientTlsStrategy implements TlsStrategy {
if (supportedProtocols != null) {
sslParameters.setProtocols(supportedProtocols);
} else if (versionPolicy != HttpVersionPolicy.FORCE_HTTP_1) {
- sslParameters.setProtocols(H2TlsSupport.excludeBlacklistedProtocols(sslParameters.getProtocols()));
+ sslParameters.setProtocols(TLS.excludeWeak(sslParameters.getProtocols()));
}
if (supportedCipherSuites != null) {
sslParameters.setCipherSuites(supportedCipherSuites);
} else if (versionPolicy != HttpVersionPolicy.FORCE_HTTP_1) {
- sslParameters.setCipherSuites(H2TlsSupport.excludeBlacklistedCiphers(sslParameters.getCipherSuites()));
+ sslParameters.setCipherSuites(TlsCiphers.excludeH2Blacklisted(sslParameters.getCipherSuites()));
}
if (versionPolicy != HttpVersionPolicy.FORCE_HTTP_1) {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java
index 35cdf78..fe373c7 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java
@@ -31,7 +31,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -50,6 +49,8 @@ import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.protocol.HttpContext;
+import org.apache.hc.core5.http.ssl.TLS;
+import org.apache.hc.core5.http.ssl.TlsCiphers;
import org.apache.hc.core5.io.Closer;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.ssl.SSLInitializationException;
@@ -238,32 +239,12 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
if (supportedProtocols != null) {
sslsock.setEnabledProtocols(supportedProtocols);
} else {
- // If supported protocols are not explicitly set, remove all SSL protocol versions
- final String[] allProtocols = sslsock.getEnabledProtocols();
- final List<String> enabledProtocols = new ArrayList<>(allProtocols.length);
- for (final String protocol: allProtocols) {
- if (!protocol.startsWith("SSL")) {
- enabledProtocols.add(protocol);
- }
- }
- if (!enabledProtocols.isEmpty()) {
- sslsock.setEnabledProtocols(enabledProtocols.toArray(new String[enabledProtocols.size()]));
- }
+ sslsock.setEnabledProtocols((TLS.excludeWeak(sslsock.getEnabledProtocols())));
}
if (supportedCipherSuites != null) {
sslsock.setEnabledCipherSuites(supportedCipherSuites);
} else {
- // If cipher suites are not explicitly set, remove all insecure ones
- final String[] allCipherSuites = sslsock.getEnabledCipherSuites();
- final List<String> enabledCipherSuites = new ArrayList<>(allCipherSuites.length);
- for (final String cipherSuite : allCipherSuites) {
- if (!isWeakCipherSuite(cipherSuite)) {
- enabledCipherSuites.add(cipherSuite);
- }
- }
- if (!enabledCipherSuites.isEmpty()) {
- sslsock.setEnabledCipherSuites(enabledCipherSuites.toArray(new String[enabledCipherSuites.size()]));
- }
+ sslsock.setEnabledCipherSuites(TlsCiphers.excludeWeak(sslsock.getEnabledCipherSuites()));
}
if (this.log.isDebugEnabled()) {
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
index a0d965a..1481e01 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientFullDuplexExchange.java
@@ -40,15 +40,15 @@ import org.apache.hc.core5.http.EntityDetails;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpResponse;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
-import org.apache.hc.core5.http.nio.BasicRequestProducer;
-import org.apache.hc.core5.http.nio.BasicResponseConsumer;
import org.apache.hc.core5.http.nio.CapacityChannel;
import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.RequestChannel;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
+import org.apache.hc.core5.http.nio.support.BasicResponseConsumer;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
@@ -70,7 +70,7 @@ public class AsyncClientFullDuplexExchange {
final MinimalHttpAsyncClient client = HttpAsyncClients.createMinimal(
HttpVersionPolicy.NEGOTIATE,
H2Config.DEFAULT,
- H1Config.DEFAULT,
+ Http1Config.DEFAULT,
ioReactorConfig);
client.start();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java
index 77afa34..9c3d377 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp1Pipelining.java
@@ -39,7 +39,7 @@ import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.client5.http.impl.async.MinimalHttpAsyncClient;
import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.io.CloseMode;
@@ -58,7 +58,7 @@ public class AsyncClientHttp1Pipelining {
.build();
final MinimalHttpAsyncClient client = HttpAsyncClients.createMinimal(
- HttpVersionPolicy.FORCE_HTTP_1, null, H1Config.DEFAULT, ioReactorConfig);
+ HttpVersionPolicy.FORCE_HTTP_1, null, Http1Config.DEFAULT, ioReactorConfig);
client.start();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
index 9599ddb..9cc783d 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
@@ -41,13 +41,13 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
-import org.apache.hc.core5.http.nio.BasicRequestProducer;
-import org.apache.hc.core5.http.nio.BasicResponseConsumer;
import org.apache.hc.core5.http.nio.CapacityChannel;
import org.apache.hc.core5.http.nio.DataStreamChannel;
import org.apache.hc.core5.http.nio.RequestChannel;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityConsumer;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
+import org.apache.hc.core5.http.nio.support.BasicResponseConsumer;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
index bbb17b0..12fcd53 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
@@ -147,11 +147,6 @@ public class AsyncClientHttp2ServerPush {
}
@Override
- public Void getResult() {
- return null;
- }
-
- @Override
public void releaseResources() {
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
index 4a955b9..92673e3 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
@@ -96,11 +96,6 @@ public class AsyncClientHttpExchangeStreaming {
}
@Override
- public Void getResult() {
- return null;
- }
-
- @Override
public void failed(final Exception cause) {
System.out.println(requestUri + "->" + cause);
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
index 22c28a2..b3dcc58 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
@@ -116,11 +116,6 @@ public class AsyncQuickStart {
}
@Override
- public HttpResponse getResult() {
- return response;
- }
-
- @Override
public void releaseResources() {
}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java
index 54db78e..b063f7c 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientConfiguration.java
@@ -41,9 +41,9 @@ import org.apache.hc.client5.http.SystemDefaultDnsResolver;
import org.apache.hc.client5.http.auth.AuthSchemes;
import org.apache.hc.client5.http.auth.CredentialsProvider;
import org.apache.hc.client5.http.classic.methods.HttpGet;
-import org.apache.hc.client5.http.cookie.CookieSpecs;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.cookie.BasicCookieStore;
+import org.apache.hc.client5.http.cookie.CookieSpecs;
import org.apache.hc.client5.http.cookie.CookieStore;
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
@@ -62,7 +62,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.config.CharCodingConfig;
-import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.config.Registry;
import org.apache.hc.core5.http.config.RegistryBuilder;
import org.apache.hc.core5.http.impl.io.DefaultClassicHttpResponseFactory;
@@ -98,7 +98,7 @@ public class ClientConfiguration {
final HttpMessageParserFactory<ClassicHttpResponse> responseParserFactory = new DefaultHttpResponseParserFactory() {
@Override
- public HttpMessageParser<ClassicHttpResponse> create(final H1Config h1Config) {
+ public HttpMessageParser<ClassicHttpResponse> create(final Http1Config h1Config) {
final LineParser lineParser = new BasicLineParser() {
@Override
@@ -118,7 +118,7 @@ public class ClientConfiguration {
final HttpMessageWriterFactory<ClassicHttpRequest> requestWriterFactory = new DefaultHttpRequestWriterFactory();
// Create HTTP/1.1 protocol configuration
- final H1Config h1Config = H1Config.custom()
+ final Http1Config h1Config = Http1Config.custom()
.setMaxHeaderCount(200)
.setMaxLineLength(2000)
.build();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
index 2f2abde..9803e2c 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ReactiveClientFullDuplexExchange.java
@@ -38,8 +38,8 @@ import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.Message;
-import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.nio.BasicRequestProducer;
+import org.apache.hc.core5.http.config.Http1Config;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
import org.apache.hc.core5.io.CloseMode;
@@ -69,7 +69,7 @@ public class ReactiveClientFullDuplexExchange {
final MinimalHttpAsyncClient client = HttpAsyncClients.createMinimal(
HttpVersionPolicy.NEGOTIATE,
H2Config.DEFAULT,
- H1Config.DEFAULT,
+ Http1Config.DEFAULT,
ioReactorConfig);
client.start();
diff --git a/pom.xml b/pom.xml
index 76777e5..fc3dd68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -67,7 +67,7 @@
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
- <httpcore.version>5.0-beta7</httpcore.version>
+ <httpcore.version>5.0-beta8</httpcore.version>
<log4j.version>2.9.1</log4j.version>
<commons-codec.version>1.12</commons-codec.version>
<conscrypt.version>1.4.1</conscrypt.version>
[httpcomponents-client] 02/03: Deprecated HttpClient functionality
now provided out of HttpCore
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch httpcore-5.0b8-upgrade
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit eb7392121746751b0d0e0290f68feaa1da7445dc
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Thu Jun 6 16:55:38 2019 +0200
Deprecated HttpClient functionality now provided out of HttpCore
---
.../http/impl/cache/BasicHttpAsyncCache.java | 6 +-
.../hc/client5/http/impl/cache/BasicHttpCache.java | 6 +-
.../org/apache/hc/client5/http/fluent/Request.java | 4 +-
.../async/AbstractHttpAsyncFundamentalsTest.java | 14 +-
.../testing/async/TestHttpAsyncMinimal.java | 9 +-
.../apache/hc/client5/http/StandardMethods.java | 3 +
.../http/async/methods/AsyncRequestBuilder.java | 84 +++---
.../client5/http/async/methods/HttpRequests.java | 34 +--
.../http/async/methods/SimpleHttpRequest.java | 6 +-
.../http/async/methods/SimpleHttpRequests.java | 34 +--
.../http/classic/methods/RequestBuilder.java | 3 +
.../http/impl/DefaultHttpRequestRetryHandler.java | 4 +-
.../client5/http/impl/async/AsyncProtocolExec.java | 4 +-
.../client5/http/impl/async/AsyncRedirectExec.java | 6 +-
.../hc/client5/http/impl/classic/ProtocolExec.java | 4 +-
.../hc/client5/http/impl/classic/RedirectExec.java | 9 +-
.../client5/http/ssl/ClientTlsStrategyBuilder.java | 1 +
.../ssl/SSLConnectionSocketFactoryBuilder.java | 1 +
.../java/org/apache/hc/client5/http/ssl/TLS.java | 10 +-
.../hc/client5/http/ssl/TlsSessionValidator.java | 1 +
.../hc/client5/http/ssl/TlsVersionParser.java | 105 --------
.../async/methods/TestAsyncRequestBuilder.java | 42 ---
.../http/classic/methods/TestRequestBuilder.java | 296 ---------------------
.../http/examples/AsyncClientHttp2ServerPush.java | 5 +-
.../examples/AsyncClientHttpExchangeStreaming.java | 5 +-
.../http/examples/AsyncClientMessageTrailers.java | 2 +-
.../hc/client5/http/examples/AsyncQuickStart.java | 2 +-
.../hc/client5/http/examples/ClientCustomSSL.java | 2 +-
.../hc/client5/http/examples/ClientFormLogin.java | 4 +-
.../impl/classic/TestContentCompressionExec.java | 20 +-
.../hc/client5/http/ssl/TestTlsVersionParser.java | 93 -------
31 files changed, 148 insertions(+), 671 deletions(-)
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpAsyncCache.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpAsyncCache.java
index f936bc1..9494d2f 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpAsyncCache.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpAsyncCache.java
@@ -31,7 +31,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.cache.HeaderConstants;
import org.apache.hc.client5.http.cache.HttpAsyncCacheInvalidator;
import org.apache.hc.client5.http.cache.HttpAsyncCacheStorage;
@@ -48,6 +47,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.message.RequestLine;
import org.apache.hc.core5.http.message.StatusLine;
import org.apache.hc.core5.util.ByteArrayBuffer;
@@ -100,7 +100,7 @@ class BasicHttpAsyncCache implements HttpAsyncCache {
if (log.isDebugEnabled()) {
log.debug("Flush cache entries: " + host + "; " + new RequestLine(request));
}
- if (!StandardMethods.isSafe(request.getMethod())) {
+ if (!Methods.isSafe(request.getMethod())) {
final String cacheKey = cacheKeyGenerator.generateKey(host, request);
return storage.removeEntry(cacheKey, new FutureCallback<Boolean>() {
@@ -147,7 +147,7 @@ class BasicHttpAsyncCache implements HttpAsyncCache {
if (log.isDebugEnabled()) {
log.debug("Flush cache entries invalidated by exchange: " + host + "; " + new RequestLine(request) + " -> " + new StatusLine(response));
}
- if (!StandardMethods.isSafe(request.getMethod())) {
+ if (!Methods.isSafe(request.getMethod())) {
return cacheInvalidator.flushCacheEntriesInvalidatedByExchange(host, request, response, cacheKeyGenerator, storage, callback);
}
callback.completed(Boolean.TRUE);
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java
index 8343e94..14b3638 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java
@@ -30,7 +30,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.cache.HeaderConstants;
import org.apache.hc.client5.http.cache.HttpCacheCASOperation;
import org.apache.hc.client5.http.cache.HttpCacheEntry;
@@ -43,6 +42,7 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.message.RequestLine;
import org.apache.hc.core5.http.message.StatusLine;
import org.apache.hc.core5.util.ByteArrayBuffer;
@@ -102,7 +102,7 @@ class BasicHttpCache implements HttpCache {
if (log.isDebugEnabled()) {
log.debug("Flush cache entries: " + host + "; " + new RequestLine(request));
}
- if (!StandardMethods.isSafe(request.getMethod())) {
+ if (!Methods.isSafe(request.getMethod())) {
final String cacheKey = cacheKeyGenerator.generateKey(host, request);
try {
storage.removeEntry(cacheKey);
@@ -127,7 +127,7 @@ class BasicHttpCache implements HttpCache {
if (log.isDebugEnabled()) {
log.debug("Flush cache entries invalidated by exchange: " + host + "; " + new RequestLine(request) + " -> " + new StatusLine(response));
}
- if (!StandardMethods.isSafe(request.getMethod())) {
+ if (!Methods.isSafe(request.getMethod())) {
cacheInvalidator.flushCacheEntriesInvalidatedByExchange(host, request, response, cacheKeyGenerator, storage);
}
}
diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
index 850ef6b..339abee 100644
--- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
+++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java
@@ -41,7 +41,6 @@ import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.classic.methods.ClassicHttpRequests;
import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase;
import org.apache.hc.client5.http.config.Configurable;
@@ -56,6 +55,7 @@ import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpVersion;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
import org.apache.hc.core5.http.io.entity.FileEntity;
@@ -81,7 +81,7 @@ public class Request {
private SimpleDateFormat dateFormatter;
- public static Request create(final StandardMethods method, final URI uri) {
+ public static Request create(final Methods method, final URI uri) {
return new Request(new HttpUriRequestBase(method.name(), uri));
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
index 281609e..33a47f2 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
@@ -36,7 +36,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.hc.client5.http.async.methods.AsyncRequestBuilder;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequests;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
@@ -46,8 +45,11 @@ import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.Message;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.URIScheme;
+import org.apache.hc.core5.http.nio.entity.AsyncEntityProducers;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
import org.apache.hc.core5.http.nio.support.BasicResponseConsumer;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
@@ -96,9 +98,8 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
final Random rnd = new Random(System.currentTimeMillis());
rnd.nextBytes(b1);
final Future<Message<HttpResponse, byte[]>> future = httpclient.execute(
- AsyncRequestBuilder.post(target, "/echo/")
- .setEntity(b1, ContentType.APPLICATION_OCTET_STREAM)
- .build(),
+ new BasicRequestProducer(Methods.GET, target, "/echo/",
+ AsyncEntityProducers.create(b1, ContentType.APPLICATION_OCTET_STREAM)),
new BasicResponseConsumer<>(new BasicAsyncEntityConsumer()), HttpClientContext.create(), null);
final Message<HttpResponse, byte[]> responseMessage = future.get();
Assert.assertThat(responseMessage, CoreMatchers.notNullValue());
@@ -121,9 +122,8 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
final Queue<Future<Message<HttpResponse, byte[]>>> queue = new LinkedList<>();
for (int i = 0; i < reqCount; i++) {
final Future<Message<HttpResponse, byte[]>> future = httpclient.execute(
- AsyncRequestBuilder.post(target, "/echo/")
- .setEntity(b1, ContentType.APPLICATION_OCTET_STREAM)
- .build(),
+ new BasicRequestProducer(Methods.POST, target, "/echo/",
+ AsyncEntityProducers.create(b1, ContentType.APPLICATION_OCTET_STREAM)),
new BasicResponseConsumer<>(new BasicAsyncEntityConsumer()), HttpClientContext.create(), null);
queue.add(future);
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
index 8bdd5b5..23eb5f0 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimal.java
@@ -34,7 +34,6 @@ import java.util.Random;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import org.apache.hc.client5.http.async.methods.AsyncRequestBuilder;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.client5.http.impl.async.MinimalHttpAsyncClient;
import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager;
@@ -47,10 +46,13 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpVersion;
import org.apache.hc.core5.http.Message;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.Http1Config;
import org.apache.hc.core5.http.nio.AsyncClientEndpoint;
+import org.apache.hc.core5.http.nio.entity.AsyncEntityProducers;
import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityConsumer;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
import org.apache.hc.core5.http.nio.support.BasicResponseConsumer;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
@@ -122,9 +124,8 @@ public class TestHttpAsyncMinimal extends AbstractHttpAsyncFundamentalsTest<Mini
final Queue<Future<Message<HttpResponse, byte[]>>> queue = new LinkedList<>();
for (int i = 0; i < reqCount; i++) {
final Future<Message<HttpResponse, byte[]>> future = endpoint.execute(
- AsyncRequestBuilder.post(target, "/echo/")
- .setEntity(b1, ContentType.APPLICATION_OCTET_STREAM)
- .build(),
+ new BasicRequestProducer(Methods.GET, target, "/echo/",
+ AsyncEntityProducers.create(b1, ContentType.APPLICATION_OCTET_STREAM)),
new BasicResponseConsumer<>(new BasicAsyncEntityConsumer()), HttpClientContext.create(), null);
queue.add(future);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/StandardMethods.java b/httpclient5/src/main/java/org/apache/hc/client5/http/StandardMethods.java
index 305dc73..39ba814 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/StandardMethods.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/StandardMethods.java
@@ -33,7 +33,10 @@ import java.util.Locale;
* Common HTTP methods defined by the HTTP spec.
*
* @since 5.0
+ *
+ * @deprecated Use {@link org.apache.hc.core5.http.Methods}
*/
+@Deprecated
public enum StandardMethods {
GET(true, true),
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
index 33d5f62..91a6f4f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/AsyncRequestBuilder.java
@@ -35,11 +35,11 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.NameValuePair;
import org.apache.hc.core5.http.ProtocolVersion;
import org.apache.hc.core5.http.message.BasicHeader;
@@ -66,7 +66,10 @@ import org.apache.hc.core5.util.TextUtils;
* </p>
*
* @since 5.0
+ *
+ * @deprecated Use {@link org.apache.hc.core5.http.nio.support.AsyncRequestBuilder}
*/
+@Deprecated
public class AsyncRequestBuilder {
private HttpHost host;
@@ -88,7 +91,7 @@ public class AsyncRequestBuilder {
this.method = method;
}
- AsyncRequestBuilder(final StandardMethods method) {
+ AsyncRequestBuilder(final Methods method) {
this(method.name());
}
@@ -98,18 +101,18 @@ public class AsyncRequestBuilder {
this.uri = uri;
}
- AsyncRequestBuilder(final StandardMethods method, final HttpHost host, final String path) {
+ AsyncRequestBuilder(final Methods method, final HttpHost host, final String path) {
super();
this.method = method.name();
this.host = host;
this.path = path;
}
- AsyncRequestBuilder(final StandardMethods method, final URI uri) {
+ AsyncRequestBuilder(final Methods method, final URI uri) {
this(method.name(), uri);
}
- AsyncRequestBuilder(final StandardMethods method, final String uri) {
+ AsyncRequestBuilder(final Methods method, final String uri) {
this(method.name(), uri != null ? URI.create(uri) : null);
}
@@ -123,131 +126,131 @@ public class AsyncRequestBuilder {
}
public static AsyncRequestBuilder get() {
- return new AsyncRequestBuilder(StandardMethods.GET);
+ return new AsyncRequestBuilder(Methods.GET);
}
public static AsyncRequestBuilder get(final URI uri) {
- return new AsyncRequestBuilder(StandardMethods.GET, uri);
+ return new AsyncRequestBuilder(Methods.GET, uri);
}
public static AsyncRequestBuilder get(final String uri) {
- return new AsyncRequestBuilder(StandardMethods.GET, uri);
+ return new AsyncRequestBuilder(Methods.GET, uri);
}
public static AsyncRequestBuilder get(final HttpHost host, final String path) {
- return new AsyncRequestBuilder(StandardMethods.GET, host, path);
+ return new AsyncRequestBuilder(Methods.GET, host, path);
}
public static AsyncRequestBuilder head() {
- return new AsyncRequestBuilder(StandardMethods.HEAD);
+ return new AsyncRequestBuilder(Methods.HEAD);
}
public static AsyncRequestBuilder head(final URI uri) {
- return new AsyncRequestBuilder(StandardMethods.HEAD, uri);
+ return new AsyncRequestBuilder(Methods.HEAD, uri);
}
public static AsyncRequestBuilder head(final String uri) {
- return new AsyncRequestBuilder(StandardMethods.HEAD, uri);
+ return new AsyncRequestBuilder(Methods.HEAD, uri);
}
public static AsyncRequestBuilder head(final HttpHost host, final String path) {
- return new AsyncRequestBuilder(StandardMethods.HEAD, host, path);
+ return new AsyncRequestBuilder(Methods.HEAD, host, path);
}
public static AsyncRequestBuilder patch() {
- return new AsyncRequestBuilder(StandardMethods.PATCH);
+ return new AsyncRequestBuilder(Methods.PATCH);
}
public static AsyncRequestBuilder patch(final URI uri) {
- return new AsyncRequestBuilder(StandardMethods.PATCH, uri);
+ return new AsyncRequestBuilder(Methods.PATCH, uri);
}
public static AsyncRequestBuilder patch(final String uri) {
- return new AsyncRequestBuilder(StandardMethods.PATCH, uri);
+ return new AsyncRequestBuilder(Methods.PATCH, uri);
}
public static AsyncRequestBuilder patch(final HttpHost host, final String path) {
- return new AsyncRequestBuilder(StandardMethods.PATCH, host, path);
+ return new AsyncRequestBuilder(Methods.PATCH, host, path);
}
public static AsyncRequestBuilder post() {
- return new AsyncRequestBuilder(StandardMethods.POST);
+ return new AsyncRequestBuilder(Methods.POST);
}
public static AsyncRequestBuilder post(final URI uri) {
- return new AsyncRequestBuilder(StandardMethods.POST, uri);
+ return new AsyncRequestBuilder(Methods.POST, uri);
}
public static AsyncRequestBuilder post(final String uri) {
- return new AsyncRequestBuilder(StandardMethods.POST, uri);
+ return new AsyncRequestBuilder(Methods.POST, uri);
}
public static AsyncRequestBuilder post(final HttpHost host, final String path) {
- return new AsyncRequestBuilder(StandardMethods.POST, host, path);
+ return new AsyncRequestBuilder(Methods.POST, host, path);
}
public static AsyncRequestBuilder put() {
- return new AsyncRequestBuilder(StandardMethods.PUT);
+ return new AsyncRequestBuilder(Methods.PUT);
}
public static AsyncRequestBuilder put(final URI uri) {
- return new AsyncRequestBuilder(StandardMethods.PUT, uri);
+ return new AsyncRequestBuilder(Methods.PUT, uri);
}
public static AsyncRequestBuilder put(final String uri) {
- return new AsyncRequestBuilder(StandardMethods.PUT, uri);
+ return new AsyncRequestBuilder(Methods.PUT, uri);
}
public static AsyncRequestBuilder put(final HttpHost host, final String path) {
- return new AsyncRequestBuilder(StandardMethods.PUT, host, path);
+ return new AsyncRequestBuilder(Methods.PUT, host, path);
}
public static AsyncRequestBuilder delete() {
- return new AsyncRequestBuilder(StandardMethods.DELETE);
+ return new AsyncRequestBuilder(Methods.DELETE);
}
public static AsyncRequestBuilder delete(final URI uri) {
- return new AsyncRequestBuilder(StandardMethods.DELETE, uri);
+ return new AsyncRequestBuilder(Methods.DELETE, uri);
}
public static AsyncRequestBuilder delete(final String uri) {
- return new AsyncRequestBuilder(StandardMethods.DELETE, uri);
+ return new AsyncRequestBuilder(Methods.DELETE, uri);
}
public static AsyncRequestBuilder delete(final HttpHost host, final String path) {
- return new AsyncRequestBuilder(StandardMethods.DELETE, host, path);
+ return new AsyncRequestBuilder(Methods.DELETE, host, path);
}
public static AsyncRequestBuilder trace() {
- return new AsyncRequestBuilder(StandardMethods.TRACE);
+ return new AsyncRequestBuilder(Methods.TRACE);
}
public static AsyncRequestBuilder trace(final URI uri) {
- return new AsyncRequestBuilder(StandardMethods.TRACE, uri);
+ return new AsyncRequestBuilder(Methods.TRACE, uri);
}
public static AsyncRequestBuilder trace(final String uri) {
- return new AsyncRequestBuilder(StandardMethods.TRACE, uri);
+ return new AsyncRequestBuilder(Methods.TRACE, uri);
}
public static AsyncRequestBuilder trace(final HttpHost host, final String path) {
- return new AsyncRequestBuilder(StandardMethods.TRACE, host, path);
+ return new AsyncRequestBuilder(Methods.TRACE, host, path);
}
public static AsyncRequestBuilder options() {
- return new AsyncRequestBuilder(StandardMethods.OPTIONS);
+ return new AsyncRequestBuilder(Methods.OPTIONS);
}
public static AsyncRequestBuilder options(final URI uri) {
- return new AsyncRequestBuilder(StandardMethods.OPTIONS, uri);
+ return new AsyncRequestBuilder(Methods.OPTIONS, uri);
}
public static AsyncRequestBuilder options(final String uri) {
- return new AsyncRequestBuilder(StandardMethods.OPTIONS, uri);
+ return new AsyncRequestBuilder(Methods.OPTIONS, uri);
}
public static AsyncRequestBuilder options(final HttpHost host, final String path) {
- return new AsyncRequestBuilder(StandardMethods.OPTIONS, host, path);
+ return new AsyncRequestBuilder(Methods.OPTIONS, host, path);
}
public AsyncRequestBuilder setCharset(final Charset charset) {
@@ -411,8 +414,7 @@ public class AsyncRequestBuilder {
public AsyncRequestProducer build() {
AsyncEntityProducer entityProducerCopy = this.entityProducer;
if (parameters != null && !parameters.isEmpty()) {
- if (entityProducerCopy == null && (StandardMethods.POST.name().equalsIgnoreCase(method)
- || StandardMethods.PUT.name().equalsIgnoreCase(method))) {
+ if (entityProducerCopy == null && (Methods.POST.isSame(method) || Methods.PUT.isSame(method))) {
final String content = URLEncodedUtils.format(
parameters,
charset != null ? charset : ContentType.APPLICATION_FORM_URLENCODED.getCharset());
@@ -431,8 +433,8 @@ public class AsyncRequestBuilder {
}
}
- if (entityProducerCopy != null && StandardMethods.TRACE.name().equalsIgnoreCase(method)) {
- throw new IllegalStateException(StandardMethods.TRACE.name() + " requests may not include an entity.");
+ if (entityProducerCopy != null && Methods.isSafe(method)) {
+ throw new IllegalStateException(Methods.TRACE + " requests may not include an entity.");
}
final ConfigurableHttpRequest request = host != null ?
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/HttpRequests.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/HttpRequests.java
index 056b80b..436eee8 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/HttpRequests.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/HttpRequests.java
@@ -29,8 +29,8 @@ package org.apache.hc.client5.http.async.methods;
import java.net.URI;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.message.BasicHttpRequest;
/**
@@ -43,96 +43,96 @@ public enum HttpRequests {
DELETE {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(StandardMethods.DELETE.name(), uri);
+ return new BasicHttpRequest(Methods.DELETE, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(StandardMethods.DELETE.name(), host, path);
+ return new BasicHttpRequest(Methods.DELETE, host, path);
}
},
GET {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(StandardMethods.GET.name(), uri);
+ return new BasicHttpRequest(Methods.GET, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(StandardMethods.GET.name(), host, path);
+ return new BasicHttpRequest(Methods.GET, host, path);
}
},
HEAD {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(StandardMethods.HEAD.name(), uri);
+ return new BasicHttpRequest(Methods.HEAD, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(StandardMethods.HEAD.name(), host, path);
+ return new BasicHttpRequest(Methods.HEAD, host, path);
}
},
OPTIONS {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(StandardMethods.OPTIONS.name(), uri);
+ return new BasicHttpRequest(Methods.OPTIONS, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(StandardMethods.OPTIONS.name(), host, path);
+ return new BasicHttpRequest(Methods.OPTIONS, host, path);
}
},
PATCH {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(StandardMethods.PATCH.name(), uri);
+ return new BasicHttpRequest(Methods.PATCH, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(StandardMethods.PATCH.name(), host, path);
+ return new BasicHttpRequest(Methods.PATCH, host, path);
}
},
POST {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(StandardMethods.POST.name(), uri);
+ return new BasicHttpRequest(Methods.POST, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(StandardMethods.POST.name(), host, path);
+ return new BasicHttpRequest(Methods.POST, host, path);
}
},
PUT {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(StandardMethods.PUT.name(), uri);
+ return new BasicHttpRequest(Methods.PUT, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(StandardMethods.PUT.name(), host, path);
+ return new BasicHttpRequest(Methods.PUT, host, path);
}
},
TRACE {
@Override
public BasicHttpRequest create(final URI uri) {
- return new BasicHttpRequest(StandardMethods.TRACE.name(), uri);
+ return new BasicHttpRequest(Methods.TRACE, uri);
}
@Override
public BasicHttpRequest create(final HttpHost host, final String path) {
- return new BasicHttpRequest(StandardMethods.TRACE.name(), host, path);
+ return new BasicHttpRequest(Methods.TRACE, host, path);
}
};
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
index 51306e5..efb63de 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequest.java
@@ -30,11 +30,11 @@ package org.apache.hc.client5.http.async.methods;
import java.net.URI;
import java.util.Iterator;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.util.Args;
/**
@@ -73,11 +73,11 @@ public final class SimpleHttpRequest extends ConfigurableHttpRequest {
super(method, requestUri);
}
- SimpleHttpRequest(final StandardMethods method, final URI requestUri) {
+ SimpleHttpRequest(final Methods method, final URI requestUri) {
this(method.name(), requestUri);
}
- SimpleHttpRequest(final StandardMethods method, final HttpHost host, final String path) {
+ SimpleHttpRequest(final Methods method, final HttpHost host, final String path) {
this(method.name(), host, path);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequests.java b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequests.java
index f5dd6c8..13f5d7e 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequests.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/async/methods/SimpleHttpRequests.java
@@ -29,8 +29,8 @@ package org.apache.hc.client5.http.async.methods;
import java.net.URI;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.Methods;
/**
* Common HTTP methods using {@link SimpleHttpRequest} as a HTTP request message representation.
@@ -42,96 +42,96 @@ public enum SimpleHttpRequests {
DELETE {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(StandardMethods.DELETE.name(), uri);
+ return new SimpleHttpRequest(Methods.DELETE, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(StandardMethods.DELETE.name(), host, path);
+ return new SimpleHttpRequest(Methods.DELETE, host, path);
}
},
GET {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(StandardMethods.GET.name(), uri);
+ return new SimpleHttpRequest(Methods.GET, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(StandardMethods.GET.name(), host, path);
+ return new SimpleHttpRequest(Methods.GET, host, path);
}
},
HEAD {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(StandardMethods.HEAD.name(), uri);
+ return new SimpleHttpRequest(Methods.HEAD, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(StandardMethods.HEAD.name(), host, path);
+ return new SimpleHttpRequest(Methods.HEAD, host, path);
}
},
OPTIONS {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(StandardMethods.OPTIONS.name(), uri);
+ return new SimpleHttpRequest(Methods.OPTIONS, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(StandardMethods.OPTIONS.name(), host, path);
+ return new SimpleHttpRequest(Methods.OPTIONS, host, path);
}
},
PATCH {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(StandardMethods.PATCH.name(), uri);
+ return new SimpleHttpRequest(Methods.PATCH, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(StandardMethods.PATCH.name(), host, path);
+ return new SimpleHttpRequest(Methods.PATCH, host, path);
}
},
POST {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(StandardMethods.POST.name(), uri);
+ return new SimpleHttpRequest(Methods.POST, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(StandardMethods.POST.name(), host, path);
+ return new SimpleHttpRequest(Methods.POST, host, path);
}
},
PUT {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(StandardMethods.PUT.name(), uri);
+ return new SimpleHttpRequest(Methods.PUT, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(StandardMethods.PUT.name(), host, path);
+ return new SimpleHttpRequest(Methods.PUT, host, path);
}
},
TRACE {
@Override
public SimpleHttpRequest create(final URI uri) {
- return new SimpleHttpRequest(StandardMethods.TRACE.name(), uri);
+ return new SimpleHttpRequest(Methods.TRACE, uri);
}
@Override
public SimpleHttpRequest create(final HttpHost host, final String path) {
- return new SimpleHttpRequest(StandardMethods.TRACE.name(), host, path);
+ return new SimpleHttpRequest(Methods.TRACE, host, path);
}
};
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/classic/methods/RequestBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/classic/methods/RequestBuilder.java
index cc6aad2..3f8f4ab 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/classic/methods/RequestBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/classic/methods/RequestBuilder.java
@@ -67,7 +67,10 @@ import org.apache.hc.core5.util.Args;
* </p>
*
* @since 4.3
+ *
+ * @deprecated Use {@link org.apache.hc.core5.http.io.support.ClassicRequestBuilder}
*/
+@Deprecated
public class RequestBuilder {
private String method;
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryHandler.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryHandler.java
index fcb4883..2591aa9 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryHandler.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/DefaultHttpRequestRetryHandler.java
@@ -38,12 +38,12 @@ import java.util.Set;
import javax.net.ssl.SSLException;
import org.apache.hc.client5.http.HttpRequestRetryHandler;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior;
import org.apache.hc.core5.concurrent.CancellableDependency;
import org.apache.hc.core5.http.ConnectionClosedException;
import org.apache.hc.core5.http.HttpRequest;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.Args;
@@ -163,7 +163,7 @@ public class DefaultHttpRequestRetryHandler implements HttpRequestRetryHandler {
* @since 4.2
*/
protected boolean handleAsIdempotent(final HttpRequest request) {
- return StandardMethods.isIdempotent(request.getMethod());
+ return Methods.isIdempotent(request.getMethod());
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
index fac2d00..404e3de 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncProtocolExec.java
@@ -34,7 +34,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.hc.client5.http.AuthenticationStrategy;
import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.async.AsyncExecCallback;
import org.apache.hc.client5.http.async.AsyncExecChain;
import org.apache.hc.client5.http.async.AsyncExecChainHandler;
@@ -58,6 +57,7 @@ import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.nio.AsyncDataConsumer;
import org.apache.hc.core5.http.nio.AsyncEntityProducer;
@@ -180,7 +180,7 @@ public final class AsyncProtocolExec implements AsyncExecChainHandler {
clientContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
httpProcessor.process(response, entityDetails, clientContext);
- if (request.getMethod().equalsIgnoreCase(StandardMethods.TRACE.name())) {
+ if (Methods.TRACE.isSame(request.getMethod())) {
// Do not perform authentication for TRACE request
return asyncExecCallback.handleResponse(response, entityDetails);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java
index 225f362..2cc0715 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AsyncRedirectExec.java
@@ -32,7 +32,6 @@ import java.net.URI;
import org.apache.hc.client5.http.CircularRedirectException;
import org.apache.hc.client5.http.HttpRoute;
import org.apache.hc.client5.http.RedirectException;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.async.AsyncExecCallback;
import org.apache.hc.client5.http.async.AsyncExecChain;
import org.apache.hc.client5.http.async.AsyncExecChainHandler;
@@ -52,6 +51,7 @@ import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.message.BasicHttpRequest;
import org.apache.hc.core5.http.nio.AsyncDataConsumer;
@@ -141,8 +141,8 @@ public final class AsyncRedirectExec implements AsyncExecChainHandler {
case HttpStatus.SC_MOVED_PERMANENTLY:
case HttpStatus.SC_MOVED_TEMPORARILY:
case HttpStatus.SC_SEE_OTHER:
- if (!StandardMethods.isSafe(request.getMethod())) {
- final HttpRequest httpGet = new BasicHttpRequest(StandardMethods.GET.name(), redirectUri);
+ if (!Methods.isSafe(request.getMethod())) {
+ final HttpRequest httpGet = new BasicHttpRequest(Methods.GET, redirectUri);
httpGet.setHeaders(scope.originalRequest.getHeaders());
state.currentRequest = httpGet;
state.currentEntityProducer = null;
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
index 0f351f3..fc36f46 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java
@@ -34,7 +34,6 @@ import java.util.Iterator;
import org.apache.hc.client5.http.AuthenticationStrategy;
import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.auth.AuthExchange;
import org.apache.hc.client5.http.auth.ChallengeType;
import org.apache.hc.client5.http.auth.CredentialsProvider;
@@ -58,6 +57,7 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.protocol.HttpCoreContext;
@@ -166,7 +166,7 @@ public final class ProtocolExec implements ExecChainHandler {
context.setAttribute(HttpCoreContext.HTTP_RESPONSE, response);
httpProcessor.process(response, response.getEntity(), context);
- if (request.getMethod().equalsIgnoreCase(StandardMethods.TRACE.name())) {
+ if (Methods.TRACE.isSame(request.getMethod())) {
// Do not perform authentication for TRACE request
return response;
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java
index f6fa97f..c09a2ae 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/RedirectExec.java
@@ -33,12 +33,10 @@ import java.net.URI;
import org.apache.hc.client5.http.CircularRedirectException;
import org.apache.hc.client5.http.HttpRoute;
import org.apache.hc.client5.http.RedirectException;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.auth.AuthExchange;
import org.apache.hc.client5.http.classic.ExecChain;
import org.apache.hc.client5.http.classic.ExecChainHandler;
import org.apache.hc.client5.http.classic.methods.HttpGet;
-import org.apache.hc.client5.http.classic.methods.RequestBuilder;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.client5.http.protocol.RedirectLocations;
@@ -54,8 +52,10 @@ import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpStatus;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.LangUtils;
import org.slf4j.Logger;
@@ -143,7 +143,7 @@ public final class RedirectExec implements ExecChainHandler {
case HttpStatus.SC_MOVED_PERMANENTLY:
case HttpStatus.SC_MOVED_TEMPORARILY:
case HttpStatus.SC_SEE_OTHER:
- if (!StandardMethods.isSafe(request.getMethod())) {
+ if (!Methods.isSafe(request.getMethod())) {
final HttpGet httpGet = new HttpGet(redirectUri);
httpGet.setHeaders(originalRequest.getHeaders());
redirect = httpGet;
@@ -152,7 +152,8 @@ public final class RedirectExec implements ExecChainHandler {
}
}
if (redirect == null) {
- redirect = RequestBuilder.copy(originalRequest).setUri(redirectUri).build();
+ redirect = new BasicClassicHttpRequest(originalRequest.getMethod(), redirectUri);
+ redirect.setEntity(originalRequest.getEntity());
}
final HttpHost newTarget = URIUtils.extractHost(redirectUri);
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ClientTlsStrategyBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ClientTlsStrategyBuilder.java
index d7768d7..babe670 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ClientTlsStrategyBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/ClientTlsStrategyBuilder.java
@@ -33,6 +33,7 @@ import javax.net.ssl.SSLEngine;
import org.apache.hc.core5.function.Factory;
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
+import org.apache.hc.core5.http.ssl.TLS;
import org.apache.hc.core5.reactor.ssl.SSLBufferMode;
import org.apache.hc.core5.reactor.ssl.TlsDetails;
import org.apache.hc.core5.ssl.SSLContexts;
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactoryBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactoryBuilder.java
index 8af69fb..2310c30 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactoryBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactoryBuilder.java
@@ -30,6 +30,7 @@ package org.apache.hc.client5.http.ssl;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
+import org.apache.hc.core5.http.ssl.TLS;
import org.apache.hc.core5.ssl.SSLContexts;
/**
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TLS.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TLS.java
index a369d6f..5d175ea 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TLS.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TLS.java
@@ -29,13 +29,15 @@ package org.apache.hc.client5.http.ssl;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.message.ParserCursor;
/**
* Supported {@code TLS} protocol versions.
*
* @since 5.0
+ *
+ * @deprecated Use {@link org.apache.hc.core5.http.ssl.TLS}
*/
+@Deprecated
public enum TLS {
V_1_0("TLSv1", new ProtocolVersion("TLS", 1, 0)),
@@ -68,11 +70,7 @@ public enum TLS {
}
public static ProtocolVersion parse(final String s) throws ParseException {
- if (s == null) {
- return null;
- }
- final ParserCursor cursor = new ParserCursor(0, s.length());
- return TlsVersionParser.INSTANCE.parse(s, cursor, null);
+ return org.apache.hc.core5.http.ssl.TLS.parse(s);
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java
index 1901909..6c3cf54 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsSessionValidator.java
@@ -41,6 +41,7 @@ import javax.security.auth.x500.X500Principal;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.ProtocolVersion;
+import org.apache.hc.core5.http.ssl.TLS;
import org.slf4j.Logger;
final class TlsSessionValidator {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsVersionParser.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsVersionParser.java
deleted file mode 100644
index 606bdea..0000000
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/TlsVersionParser.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.ssl;
-
-import java.util.BitSet;
-
-import org.apache.hc.core5.http.ParseException;
-import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.message.ParserCursor;
-import org.apache.hc.core5.http.message.TokenParser;
-
-final class TlsVersionParser {
-
- public final static TlsVersionParser INSTANCE = new TlsVersionParser();
-
- private final TokenParser tokenParser;
-
- TlsVersionParser() {
- this.tokenParser = TokenParser.INSTANCE;
- }
-
- ProtocolVersion parse(
- final CharSequence buffer,
- final ParserCursor cursor,
- final BitSet delimiters) throws ParseException {
- final int lowerBound = cursor.getLowerBound();
- final int upperBound = cursor.getUpperBound();
-
- int pos = cursor.getPos();
- if (pos + 4 > cursor.getUpperBound()) {
- throw new ParseException("Invalid TLS protocol version", buffer, lowerBound, upperBound, pos);
- }
- if (buffer.charAt(pos) != 'T' || buffer.charAt(pos + 1) != 'L' || buffer.charAt(pos + 2) != 'S'
- || buffer.charAt(pos + 3) != 'v') {
- throw new ParseException("Invalid TLS protocol version", buffer, lowerBound, upperBound, pos);
- }
- pos = pos + 4;
- cursor.updatePos(pos);
- if (cursor.atEnd()) {
- throw new ParseException("Invalid TLS version", buffer, lowerBound, upperBound, pos);
- }
- final String s = this.tokenParser.parseToken(buffer, cursor, delimiters);
- final int idx = s.indexOf('.');
- if (idx == -1) {
- final int major;
- try {
- major = Integer.parseInt(s);
- } catch (final NumberFormatException e) {
- throw new ParseException("Invalid TLS major version", buffer, lowerBound, upperBound, pos);
- }
- return new ProtocolVersion("TLS", major, 0);
- } else {
- final String s1 = s.substring(0, idx);
- final int major;
- try {
- major = Integer.parseInt(s1);
- } catch (final NumberFormatException e) {
- throw new ParseException("Invalid TLS major version", buffer, lowerBound, upperBound, pos);
- }
- final String s2 = s.substring(idx + 1);
- final int minor;
- try {
- minor = Integer.parseInt(s2);
- } catch (final NumberFormatException e) {
- throw new ParseException("Invalid TLS minor version", buffer, lowerBound, upperBound, pos);
- }
- return new ProtocolVersion("TLS", major, minor);
- }
- }
-
- ProtocolVersion parse(final String s) throws ParseException {
- if (s == null) {
- return null;
- }
- final ParserCursor cursor = new ParserCursor(0, s.length());
- return parse(s, cursor, null);
- }
-
-}
-
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/async/methods/TestAsyncRequestBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/async/methods/TestAsyncRequestBuilder.java
deleted file mode 100644
index cb1e5e9..0000000
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/async/methods/TestAsyncRequestBuilder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.async.methods;
-
-import org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer;
-import org.junit.Test;
-
-public class TestAsyncRequestBuilder {
-
- @Test(expected = IllegalStateException.class)
- public void testBuildTraceWithEntity() {
- final AsyncRequestBuilder builder = AsyncRequestBuilder.create("TRACE").setUri("/path");
- builder.setEntity(new BasicAsyncEntityProducer("stuff"));
- builder.build();
- }
-
-}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestRequestBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestRequestBuilder.java
deleted file mode 100644
index b6789c2..0000000
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestRequestBuilder.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.classic.methods;
-
-import java.net.URI;
-import java.net.URLEncoder;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-
-import org.apache.hc.client5.http.config.Configurable;
-import org.apache.hc.client5.http.config.RequestConfig;
-import org.apache.hc.core5.http.ClassicHttpRequest;
-import org.apache.hc.core5.http.ContentType;
-import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HttpEntity;
-import org.apache.hc.core5.http.HttpVersion;
-import org.apache.hc.core5.http.NameValuePair;
-import org.apache.hc.core5.http.io.entity.EntityUtils;
-import org.apache.hc.core5.http.io.entity.StringEntity;
-import org.apache.hc.core5.http.message.BasicHeader;
-import org.apache.hc.core5.http.message.BasicNameValuePair;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestRequestBuilder {
-
- @Test
- public void testBasicGet() throws Exception {
- final ClassicHttpRequest request = RequestBuilder.get().build();
- Assert.assertNotNull(request);
- Assert.assertEquals("GET", request.getMethod());
- Assert.assertEquals(URI.create("/"), request.getUri());
- }
-
- @Test
- public void testArbitraryMethod() throws Exception {
- final ClassicHttpRequest request = RequestBuilder.create("Whatever").build();
- Assert.assertNotNull(request);
- Assert.assertEquals("Whatever", request.getMethod());
- Assert.assertEquals(URI.create("/"), request.getUri());
- }
-
- @Test
- public void testBasicWithEntity() throws Exception {
- final HttpEntity entity = new StringEntity("whatever");
- final ClassicHttpRequest request = RequestBuilder.post().setEntity(entity).build();
- Assert.assertNotNull(request);
- Assert.assertEquals("POST", request.getMethod());
- Assert.assertEquals(URI.create("/"), request.getUri());
- Assert.assertSame(entity, request.getEntity());
- }
-
- @Test
- public void testGetWithEntity() throws Exception {
- final HttpEntity entity = new StringEntity("whatever");
- final ClassicHttpRequest request = RequestBuilder.get().setEntity(entity).build();
- Assert.assertNotNull(request);
- Assert.assertEquals("GET", request.getMethod());
- Assert.assertEquals(URI.create("/"), request.getUri());
- Assert.assertSame(entity, request.getEntity());
- }
-
- @Test
- public void testAddParameters1() throws Exception {
- final ClassicHttpRequest request = RequestBuilder.get()
- .addParameter("p1", "this")
- .addParameter("p2", "that")
- .build();
- Assert.assertEquals(new URI("/?p1=this&p2=that"), request.getUri());
- }
-
- @Test
- public void testAddParameters2() throws Exception {
- final ClassicHttpRequest request = RequestBuilder.get()
- .addParameter("p1", "this")
- .addParameters(new BasicNameValuePair("p2", "that"))
- .build();
- Assert.assertEquals(new URI("/?p1=this&p2=that"), request.getUri());
- }
-
- @Test
- public void testAddParameters3() throws Exception {
- final ClassicHttpRequest request = RequestBuilder.post()
- .addParameter("p1", "this")
- .addParameter("p2", "that")
- .build();
- final HttpEntity entity = request.getEntity();
- Assert.assertNotNull(entity);
- Assert.assertEquals(new URI("/"), request.getUri());
- Assert.assertEquals("p1=this&p2=that", EntityUtils.toString(entity));
- }
-
- @Test
- public void testAddParameters4() throws Exception {
- final ClassicHttpRequest request = RequestBuilder.post()
- .setUri("http://targethost/?blah")
- .addParameter("p1", "this")
- .addParameter("p2", "that")
- .setEntity(new StringEntity("blah"))
- .build();
- Assert.assertEquals(new URI("http://targethost/?blah&p1=this&p2=that"), request.getUri());
- }
-
- @Test
- public void testCopy() throws Exception {
- final HttpEntity entity = new StringEntity("stuff");
- final RequestConfig config = RequestConfig.custom().build();
- final ClassicHttpRequest request = RequestBuilder.put()
- .setUri(URI.create("/stuff"))
- .setVersion(HttpVersion.HTTP_1_0)
- .addHeader("header1", "stuff")
- .setHeader("header2", "more stuff")
- .setEntity(entity)
- .setConfig(config)
- .build();
- Assert.assertNotNull(request);
- Assert.assertEquals("PUT", request.getMethod());
- Assert.assertEquals(URI.create("/stuff"), request.getUri());
- Assert.assertEquals(HttpVersion.HTTP_1_0, request.getVersion());
-
- final ClassicHttpRequest copy = RequestBuilder.copy(request).setUri("/other-stuff").build();
- Assert.assertEquals("PUT", copy.getMethod());
- Assert.assertEquals(URI.create("/other-stuff"), copy.getUri());
- Assert.assertSame(entity, copy.getEntity());
- Assert.assertTrue(copy instanceof Configurable);
- Assert.assertSame(config, ((Configurable) copy).getConfig());
- }
-
- @Test
- public void testCopyWithQueryParams() throws Exception {
- final HttpGet get = new HttpGet("/stuff?p1=this&p2=that");
- final RequestBuilder builder = RequestBuilder.copy(get).setEntity(new StringEntity(""));
- final List<NameValuePair> parameters = builder.getParameters();
- Assert.assertNotNull(parameters);
- Assert.assertEquals(0, parameters.size());
- Assert.assertEquals(new URI("/stuff?p1=this&p2=that"), builder.getUri());
- }
-
- @Test
- public void testCopyWithFormParams() throws Exception {
- final HttpPost post = new HttpPost("/stuff?p1=wtf");
- post.setEntity(new StringEntity("p1=this&p2=that", ContentType.APPLICATION_FORM_URLENCODED));
- final RequestBuilder builder = RequestBuilder.copy(post);
- final List<NameValuePair> parameters = builder.getParameters();
- Assert.assertNotNull(parameters);
- Assert.assertEquals(2, parameters.size());
- assertNameValuePair(new BasicNameValuePair("p1", "this"), parameters.get(0));
- assertNameValuePair(new BasicNameValuePair("p2", "that"), parameters.get(1));
- Assert.assertEquals(new URI("/stuff?p1=wtf"), builder.getUri());
- Assert.assertNull(builder.getEntity());
- }
-
- private static void assertNameValuePair (
- final NameValuePair expected,
- final NameValuePair result) {
- Assert.assertNotNull(result);
- Assert.assertEquals(expected.getName(), result.getName());
- Assert.assertEquals(expected.getValue(), result.getValue());
- }
-
- @Test
- public void testCopyWithStringEntity() throws Exception {
- final HttpPost post = new HttpPost("/stuff?p1=wtf");
- final HttpEntity entity = new StringEntity("p1=this&p2=that", ContentType.TEXT_PLAIN);
- post.setEntity(entity);
- final RequestBuilder builder = RequestBuilder.copy(post);
- final List<NameValuePair> parameters = builder.getParameters();
- Assert.assertNotNull(parameters);
- Assert.assertEquals(0, parameters.size());
- Assert.assertEquals(new URI("/stuff?p1=wtf"), builder.getUri());
- Assert.assertSame(entity, builder.getEntity());
- }
-
- @Test
- public void testCopyAndSetUri() throws Exception {
- final URI uri1 = URI.create("http://host1.com/path?param=something");
- final URI uri2 = URI.create("http://host2.com/path?param=somethingdifferent");
- final HttpGet request1 = new HttpGet(uri1);
- final ClassicHttpRequest request2 = RequestBuilder.copy(request1).setUri(uri2).build();
- Assert.assertEquals(request2.getUri(), uri2);
- }
-
- @Test
- public void testGettersAndMutators() throws Exception {
- final HttpEntity entity = new StringEntity("stuff");
- final RequestConfig config = RequestConfig.custom().build();
- final Header h1 = new BasicHeader("header1", "stuff");
- final Header h2 = new BasicHeader("header1", "more-stuff");
- final RequestBuilder builder = RequestBuilder.put()
- .setUri("/stuff")
- .setVersion(HttpVersion.HTTP_1_0)
- .addHeader(h1)
- .addHeader(h2)
- .setEntity(entity)
- .setConfig(config);
- Assert.assertEquals("PUT", builder.getMethod());
- Assert.assertEquals(URI.create("/stuff"), builder.getUri());
- Assert.assertEquals(HttpVersion.HTTP_1_0, builder.getVersion());
- Assert.assertSame(h1, builder.getFirstHeader("header1"));
- Assert.assertSame(h2, builder.getLastHeader("header1"));
- Assert.assertEquals(2, builder.getHeaders("header1").length);
- Assert.assertSame(entity, builder.getEntity());
- Assert.assertSame(config, builder.getConfig());
-
- builder.setUri((String) null)
- .setVersion(null)
- .removeHeader(h1)
- .removeHeaders("header1")
- .removeHeader(h2)
- .setEntity(null)
- .setConfig(null);
- Assert.assertEquals(null, builder.getUri());
- Assert.assertEquals(null, builder.getVersion());
- Assert.assertSame(null, builder.getFirstHeader("header1"));
- Assert.assertSame(null, builder.getLastHeader("header1"));
- Assert.assertEquals(0, builder.getHeaders("header1").length);
- Assert.assertSame(null, builder.getEntity());
- Assert.assertSame(null, builder.getConfig());
-
- builder.setHeader(h2)
- .setHeader("header1", "a-lot-more-stuff");
- Assert.assertSame("a-lot-more-stuff", builder.getLastHeader("header1").getValue());
- Assert.assertEquals(1, builder.getHeaders("header1").length);
- }
-
- @Test(expected=IllegalArgumentException.class)
- public void testCopyNull() throws Exception {
- RequestBuilder.copy(null);
- }
-
- @Test
- public void testBuildGETwithUTF8() throws Exception {
- assertBuild(StandardCharsets.UTF_8);
- }
-
- @Test
- public void testBuildGETwithISO88591() throws Exception {
- assertBuild(StandardCharsets.ISO_8859_1);
- }
-
- @Test(expected = IllegalStateException.class)
- public void testBuildTraceWithEntity() {
- final RequestBuilder requestBuilder = RequestBuilder.create("TRACE").setUri("/path");
- requestBuilder.setEntity(new StringEntity("foo"));
- requestBuilder.build();
- }
-
- private void assertBuild(final Charset charset) throws Exception {
- final RequestBuilder requestBuilder = RequestBuilder.create("GET").setCharset(charset);
- requestBuilder.setUri("https://somehost.com/stuff");
- requestBuilder.addParameters(createParameters());
-
- final String encodedData1 = URLEncoder.encode("\"1\u00aa position\"", charset.displayName());
- final String encodedData2 = URLEncoder.encode("Jos\u00e9 Abra\u00e3o", charset.displayName());
-
- final String uriExpected = String.format("https://somehost.com/stuff?parameter1=value1¶meter2=%s¶meter3=%s", encodedData1, encodedData2);
-
- final ClassicHttpRequest request = requestBuilder.build();
- Assert.assertEquals(uriExpected, request.getUri().toString());
- }
-
- private NameValuePair[] createParameters() {
- final NameValuePair parameters[] = new NameValuePair[3];
- parameters[0] = new BasicNameValuePair("parameter1", "value1");
- parameters[1] = new BasicNameValuePair("parameter2", "\"1\u00aa position\"");
- parameters[2] = new BasicNameValuePair("parameter3", "Jos\u00e9 Abra\u00e3o");
- return parameters;
- }
-
-}
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
index 12fcd53..22dc283 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
@@ -33,7 +33,6 @@ import java.util.concurrent.Future;
import org.apache.hc.client5.http.async.methods.AbstractBinPushConsumer;
import org.apache.hc.client5.http.async.methods.AbstractCharResponseConsumer;
-import org.apache.hc.client5.http.async.methods.AsyncRequestBuilder;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.core5.function.Supplier;
@@ -42,8 +41,10 @@ import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.message.StatusLine;
import org.apache.hc.core5.http.nio.AsyncPushConsumer;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.config.H2Config;
import org.apache.hc.core5.io.CloseMode;
@@ -117,7 +118,7 @@ public class AsyncClientHttp2ServerPush {
final HttpHost target = new HttpHost("nghttp2.org");
final String requestURI = "/httpbin/";
final Future<Void> future = client.execute(
- AsyncRequestBuilder.get(target, requestURI).build(),
+ new BasicRequestProducer(Methods.GET, target, requestURI),
new AbstractCharResponseConsumer<Void>() {
@Override
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
index 92673e3..c7c884f 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttpExchangeStreaming.java
@@ -31,14 +31,15 @@ import java.nio.CharBuffer;
import java.util.concurrent.Future;
import org.apache.hc.client5.http.async.methods.AbstractCharResponseConsumer;
-import org.apache.hc.client5.http.async.methods.AsyncRequestBuilder;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.HttpResponse;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.message.StatusLine;
+import org.apache.hc.core5.http.nio.support.BasicRequestProducer;
import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
@@ -65,7 +66,7 @@ public class AsyncClientHttpExchangeStreaming {
for (final String requestUri: requestUris) {
final Future<Void> future = client.execute(
- AsyncRequestBuilder.get(target, requestUri).build(),
+ new BasicRequestProducer(Methods.GET, target, requestUri),
new AbstractCharResponseConsumer<Void>() {
@Override
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java
index 0563bbe..db2b916 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientMessageTrailers.java
@@ -33,7 +33,6 @@ import java.util.concurrent.Future;
import org.apache.hc.client5.http.async.AsyncExecCallback;
import org.apache.hc.client5.http.async.AsyncExecChain;
import org.apache.hc.client5.http.async.AsyncExecChainHandler;
-import org.apache.hc.client5.http.async.methods.AsyncRequestBuilder;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
import org.apache.hc.client5.http.async.methods.SimpleResponseConsumer;
import org.apache.hc.client5.http.impl.ChainElements;
@@ -47,6 +46,7 @@ import org.apache.hc.core5.http.nio.AsyncEntityProducer;
import org.apache.hc.core5.http.nio.AsyncRequestProducer;
import org.apache.hc.core5.http.nio.entity.DigestingEntityProducer;
import org.apache.hc.core5.http.nio.entity.StringAsyncEntityProducer;
+import org.apache.hc.core5.http.nio.support.AsyncRequestBuilder;
import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.IOReactorConfig;
import org.apache.hc.core5.util.Timeout;
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
index b3dcc58..f6b4c89 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
@@ -34,7 +34,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import org.apache.hc.client5.http.async.methods.AbstractCharResponseConsumer;
-import org.apache.hc.client5.http.async.methods.AsyncRequestBuilder;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequests;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
@@ -45,6 +44,7 @@ import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.nio.AsyncRequestProducer;
+import org.apache.hc.core5.http.nio.support.AsyncRequestBuilder;
public class AsyncQuickStart {
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomSSL.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomSSL.java
index 73a4d8c..ef4b173 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomSSL.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientCustomSSL.java
@@ -41,8 +41,8 @@ import org.apache.hc.client5.http.io.HttpClientConnectionManager;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
-import org.apache.hc.client5.http.ssl.TLS;
import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.ssl.TLS;
import org.apache.hc.core5.ssl.SSLContexts;
import org.apache.hc.core5.ssl.TrustStrategy;
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientFormLogin.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientFormLogin.java
index 4d0989d..0b2d97d 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientFormLogin.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientFormLogin.java
@@ -30,7 +30,6 @@ import java.net.URI;
import java.util.List;
import org.apache.hc.client5.http.classic.methods.HttpGet;
-import org.apache.hc.client5.http.classic.methods.RequestBuilder;
import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.cookie.Cookie;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
@@ -39,6 +38,7 @@ import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.io.entity.EntityUtils;
+import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
/**
* A example that demonstrates how HttpClient APIs can be used to perform
@@ -69,7 +69,7 @@ public class ClientFormLogin {
}
}
- final ClassicHttpRequest login = RequestBuilder.post()
+ final ClassicHttpRequest login = ClassicRequestBuilder.post()
.setUri(new URI("https://someportal/"))
.addParameter("IDToken1", "username")
.addParameter("IDToken2", "password")
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestContentCompressionExec.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestContentCompressionExec.java
index ab3294d..fa2ff2b 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestContentCompressionExec.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/classic/TestContentCompressionExec.java
@@ -27,7 +27,6 @@
package org.apache.hc.client5.http.impl.classic;
import org.apache.hc.client5.http.HttpRoute;
-import org.apache.hc.client5.http.StandardMethods;
import org.apache.hc.client5.http.classic.ExecChain;
import org.apache.hc.client5.http.classic.ExecRuntime;
import org.apache.hc.client5.http.config.RequestConfig;
@@ -40,6 +39,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpException;
import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.Methods;
import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
@@ -77,7 +77,7 @@ public class TestContentCompressionExec {
@Test
public void testContentEncodingNoEntity() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
Mockito.when(execChain.proceed(request, scope)).thenReturn(response);
@@ -90,7 +90,7 @@ public class TestContentCompressionExec {
@Test
public void testNoContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final StringEntity original = new StringEntity("plain stuff");
response.setEntity(original);
@@ -106,7 +106,7 @@ public class TestContentCompressionExec {
@Test
public void testGzipContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("GZip").build();
response.setEntity(original);
@@ -122,7 +122,7 @@ public class TestContentCompressionExec {
@Test
public void testGzipContentEncodingZeroLength() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("").setContentEncoding("GZip").build();
response.setEntity(original);
@@ -138,7 +138,7 @@ public class TestContentCompressionExec {
@Test
public void testXGzipContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("x-gzip").build();
response.setEntity(original);
@@ -154,7 +154,7 @@ public class TestContentCompressionExec {
@Test
public void testDeflateContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("deFlaTe").build();
response.setEntity(original);
@@ -170,7 +170,7 @@ public class TestContentCompressionExec {
@Test
public void testIdentityContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("identity").build();
response.setEntity(original);
@@ -186,7 +186,7 @@ public class TestContentCompressionExec {
@Test(expected=HttpException.class)
public void testUnknownContentEncoding() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("whatever").build();
response.setEntity(original);
@@ -200,7 +200,7 @@ public class TestContentCompressionExec {
@Test
public void testContentEncodingRequestParameter() throws Exception {
- final ClassicHttpRequest request = new BasicClassicHttpRequest(StandardMethods.GET.name(), host, "/");
+ final ClassicHttpRequest request = new BasicClassicHttpRequest(Methods.GET, host, "/");
final ClassicHttpResponse response = new BasicClassicHttpResponse(200, "OK");
final HttpEntity original = EntityBuilder.create().setText("encoded stuff").setContentEncoding("GZip").build();
response.setEntity(original);
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/ssl/TestTlsVersionParser.java b/httpclient5/src/test/java/org/apache/hc/client5/http/ssl/TestTlsVersionParser.java
deleted file mode 100644
index 30654b6..0000000
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/ssl/TestTlsVersionParser.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.client5.http.ssl;
-
-import org.apache.hc.core5.http.ParseException;
-import org.apache.hc.core5.http.ProtocolVersion;
-import org.apache.hc.core5.http.message.ParserCursor;
-import org.apache.hc.core5.http.message.TokenParser;
-import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Unit tests for {@link TlsVersionParser}.
- */
-public class TestTlsVersionParser {
-
- private TlsVersionParser impl;
-
- @Before
- public void setup() {
- impl = new TlsVersionParser();
- }
-
- @Test
- public void testParseBasic() throws Exception {
- Assert.assertThat(impl.parse("TLSv1"), CoreMatchers.equalTo(TLS.V_1_0.version));
- Assert.assertThat(impl.parse("TLSv1.1"), CoreMatchers.equalTo(TLS.V_1_1.version));
- Assert.assertThat(impl.parse("TLSv1.2"), CoreMatchers.equalTo(TLS.V_1_2.version));
- Assert.assertThat(impl.parse("TLSv1.3"), CoreMatchers.equalTo(TLS.V_1_3.version));
- Assert.assertThat(impl.parse("TLSv22.356"), CoreMatchers.equalTo(new ProtocolVersion("TLS", 22, 356)));
- }
-
- @Test
- public void testParseBuffer() throws Exception {
- final ParserCursor cursor = new ParserCursor(1, 13);
- Assert.assertThat(impl.parse(" TLSv1.2,0000", cursor, TokenParser.INIT_BITSET(',')),
- CoreMatchers.equalTo(TLS.V_1_2.version));
- Assert.assertThat(cursor.getPos(), CoreMatchers.equalTo(8));
- }
-
- @Test(expected = ParseException.class)
- public void testParseFailure1() throws Exception {
- impl.parse("Tlsv1");
- }
-
- @Test(expected = ParseException.class)
- public void testParseFailure2() throws Exception {
- impl.parse("TLSV1");
- }
-
- @Test(expected = ParseException.class)
- public void testParseFailure3() throws Exception {
- impl.parse("TLSv");
- }
-
- @Test(expected = ParseException.class)
- public void testParseFailure4() throws Exception {
- impl.parse("TLSv1A");
- }
-
- @Test(expected = ParseException.class)
- public void testParseFailure5() throws Exception {
- impl.parse("TLSv1.A");
- }
-
-}
[httpcomponents-client] 03/03: Renamed Http2 to H2 (no functional
changes)
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch httpcore-5.0b8-upgrade
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 84e55d6d98af62d232eae8a5a621cca47ac8892b
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Fri Jul 12 15:33:21 2019 +0200
Renamed Http2 to H2 (no functional changes)
---
...ilder.java => CachingH2AsyncClientBuilder.java} | 26 +++----
.../http/impl/cache/CachingHttpAsyncClients.java | 8 +--
.../{TestHttp2Async.java => TestH2Async.java} | 10 +--
...p2AsyncMinimal.java => TestH2AsyncMinimal.java} | 8 +--
...AsyncRedirect.java => TestH2AsyncRedirect.java} | 10 +--
...cation.java => TestH2ClientAuthentication.java} | 10 +--
...lientBuilder.java => H2AsyncClientBuilder.java} | 82 +++++++++++-----------
....java => H2AsyncClientEventHandlerFactory.java} | 4 +-
...nClientExec.java => H2AsyncMainClientExec.java} | 2 +-
.../client5/http/impl/async/HttpAsyncClients.java | 34 ++++-----
...AsyncClient.java => InternalH2AsyncClient.java} | 6 +-
...untime.java => InternalH2AsyncExecRuntime.java} | 10 +--
...2AsyncClient.java => MinimalH2AsyncClient.java} | 4 +-
...e.java => AsyncClientH2FullDuplexExchange.java} | 2 +-
...plexing.java => AsyncClientH2Multiplexing.java} | 2 +-
...erverPush.java => AsyncClientH2ServerPush.java} | 2 +-
16 files changed, 110 insertions(+), 110 deletions(-)
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttp2AsyncClientBuilder.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingH2AsyncClientBuilder.java
similarity index 84%
rename from httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttp2AsyncClientBuilder.java
rename to httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingH2AsyncClientBuilder.java
index 927d79c..2dc11aa 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttp2AsyncClientBuilder.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingH2AsyncClientBuilder.java
@@ -39,7 +39,7 @@ import org.apache.hc.client5.http.cache.HttpAsyncCacheStorageAdaptor;
import org.apache.hc.client5.http.cache.HttpCacheStorage;
import org.apache.hc.client5.http.cache.ResourceFactory;
import org.apache.hc.client5.http.impl.ChainElements;
-import org.apache.hc.client5.http.impl.async.Http2AsyncClientBuilder;
+import org.apache.hc.client5.http.impl.async.H2AsyncClientBuilder;
import org.apache.hc.client5.http.impl.schedule.ImmediateSchedulingStrategy;
import org.apache.hc.client5.http.schedule.SchedulingStrategy;
import org.apache.hc.core5.http.config.NamedElementChain;
@@ -50,7 +50,7 @@ import org.apache.hc.core5.http.config.NamedElementChain;
*
* @since 5.0
*/
-public class CachingHttp2AsyncClientBuilder extends Http2AsyncClientBuilder {
+public class CachingH2AsyncClientBuilder extends H2AsyncClientBuilder {
private ResourceFactory resourceFactory;
private HttpAsyncCacheStorage storage;
@@ -60,51 +60,51 @@ public class CachingHttp2AsyncClientBuilder extends Http2AsyncClientBuilder {
private HttpAsyncCacheInvalidator httpCacheInvalidator;
private boolean deleteCache;
- public static CachingHttp2AsyncClientBuilder create() {
- return new CachingHttp2AsyncClientBuilder();
+ public static CachingH2AsyncClientBuilder create() {
+ return new CachingH2AsyncClientBuilder();
}
- protected CachingHttp2AsyncClientBuilder() {
+ protected CachingH2AsyncClientBuilder() {
super();
this.deleteCache = true;
}
- public final CachingHttp2AsyncClientBuilder setResourceFactory(final ResourceFactory resourceFactory) {
+ public final CachingH2AsyncClientBuilder setResourceFactory(final ResourceFactory resourceFactory) {
this.resourceFactory = resourceFactory;
return this;
}
- public final CachingHttp2AsyncClientBuilder setHttpCacheStorage(final HttpCacheStorage storage) {
+ public final CachingH2AsyncClientBuilder setHttpCacheStorage(final HttpCacheStorage storage) {
this.storage = storage != null ? new HttpAsyncCacheStorageAdaptor(storage) : null;
return this;
}
- public final CachingHttp2AsyncClientBuilder setHttpCacheStorage(final HttpAsyncCacheStorage storage) {
+ public final CachingH2AsyncClientBuilder setHttpCacheStorage(final HttpAsyncCacheStorage storage) {
this.storage = storage;
return this;
}
- public final CachingHttp2AsyncClientBuilder setCacheDir(final File cacheDir) {
+ public final CachingH2AsyncClientBuilder setCacheDir(final File cacheDir) {
this.cacheDir = cacheDir;
return this;
}
- public final CachingHttp2AsyncClientBuilder setSchedulingStrategy(final SchedulingStrategy schedulingStrategy) {
+ public final CachingH2AsyncClientBuilder setSchedulingStrategy(final SchedulingStrategy schedulingStrategy) {
this.schedulingStrategy = schedulingStrategy;
return this;
}
- public final CachingHttp2AsyncClientBuilder setCacheConfig(final CacheConfig cacheConfig) {
+ public final CachingH2AsyncClientBuilder setCacheConfig(final CacheConfig cacheConfig) {
this.cacheConfig = cacheConfig;
return this;
}
- public final CachingHttp2AsyncClientBuilder setHttpCacheInvalidator(final HttpAsyncCacheInvalidator cacheInvalidator) {
+ public final CachingH2AsyncClientBuilder setHttpCacheInvalidator(final HttpAsyncCacheInvalidator cacheInvalidator) {
this.httpCacheInvalidator = cacheInvalidator;
return this;
}
- public CachingHttp2AsyncClientBuilder setDeleteCache(final boolean deleteCache) {
+ public CachingH2AsyncClientBuilder setDeleteCache(final boolean deleteCache) {
this.deleteCache = deleteCache;
return this;
}
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClients.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClients.java
index 4742b00..8b20b98 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClients.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClients.java
@@ -73,8 +73,8 @@ public final class CachingHttpAsyncClients {
* Creates builder object for construction of custom HTTP/2
* {@link CloseableHttpAsyncClient} instances.
*/
- public static CachingHttp2AsyncClientBuilder customHttp2() {
- return CachingHttp2AsyncClientBuilder.create();
+ public static CachingH2AsyncClientBuilder customHttp2() {
+ return CachingH2AsyncClientBuilder.create();
}
/**
@@ -82,7 +82,7 @@ public final class CachingHttpAsyncClients {
* response cache.
*/
public static CloseableHttpAsyncClient createHttp2MemoryBound() {
- return CachingHttp2AsyncClientBuilder.create().build();
+ return CachingH2AsyncClientBuilder.create().build();
}
/**
@@ -92,7 +92,7 @@ public final class CachingHttpAsyncClients {
* @param cacheDir location of response cache.
*/
public static CloseableHttpAsyncClient createHttp2FileBound(final File cacheDir) {
- return CachingHttp2AsyncClientBuilder.create().setCacheDir(cacheDir).build();
+ return CachingH2AsyncClientBuilder.create().setCacheDir(cacheDir).build();
}
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2Async.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Async.java
similarity index 89%
rename from httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2Async.java
rename to httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Async.java
index d41fed2..2076143 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2Async.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Async.java
@@ -31,7 +31,7 @@ import java.util.Collection;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
-import org.apache.hc.client5.http.impl.async.Http2AsyncClientBuilder;
+import org.apache.hc.client5.http.impl.async.H2AsyncClientBuilder;
import org.apache.hc.client5.testing.SSLTestContexts;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
@@ -43,7 +43,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
-public class TestHttp2Async extends AbstractHttpAsyncFundamentalsTest<CloseableHttpAsyncClient> {
+public class TestH2Async extends AbstractHttpAsyncFundamentalsTest<CloseableHttpAsyncClient> {
@Parameterized.Parameters(name = "HTTP/2 {0}")
public static Collection<Object[]> protocols() {
@@ -53,14 +53,14 @@ public class TestHttp2Async extends AbstractHttpAsyncFundamentalsTest<CloseableH
});
}
- protected Http2AsyncClientBuilder clientBuilder;
+ protected H2AsyncClientBuilder clientBuilder;
@Rule
public ExternalResource clientResource = new ExternalResource() {
@Override
protected void before() throws Throwable {
- clientBuilder = Http2AsyncClientBuilder.create()
+ clientBuilder = H2AsyncClientBuilder.create()
.setDefaultRequestConfig(RequestConfig.custom()
.setConnectionRequestTimeout(TIMEOUT)
.setConnectTimeout(TIMEOUT)
@@ -70,7 +70,7 @@ public class TestHttp2Async extends AbstractHttpAsyncFundamentalsTest<CloseableH
};
- public TestHttp2Async(final URIScheme scheme) {
+ public TestH2Async(final URIScheme scheme) {
super(scheme);
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2AsyncMinimal.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncMinimal.java
similarity index 89%
rename from httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2AsyncMinimal.java
rename to httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncMinimal.java
index 2bbd1bb..f2e85fc 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2AsyncMinimal.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncMinimal.java
@@ -30,7 +30,7 @@ import java.util.Arrays;
import java.util.Collection;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
-import org.apache.hc.client5.http.impl.async.MinimalHttp2AsyncClient;
+import org.apache.hc.client5.http.impl.async.MinimalH2AsyncClient;
import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
import org.apache.hc.client5.testing.SSLTestContexts;
import org.apache.hc.core5.http.HttpHost;
@@ -41,7 +41,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
-public class TestHttp2AsyncMinimal extends AbstractHttpAsyncFundamentalsTest<MinimalHttp2AsyncClient> {
+public class TestH2AsyncMinimal extends AbstractHttpAsyncFundamentalsTest<MinimalH2AsyncClient> {
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> protocols() {
@@ -51,12 +51,12 @@ public class TestHttp2AsyncMinimal extends AbstractHttpAsyncFundamentalsTest<Min
});
}
- public TestHttp2AsyncMinimal(final URIScheme scheme) {
+ public TestH2AsyncMinimal(final URIScheme scheme) {
super(scheme);
}
@Override
- protected MinimalHttp2AsyncClient createClient() throws Exception {
+ protected MinimalH2AsyncClient createClient() throws Exception {
final IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
.setSoTimeout(TIMEOUT)
.build();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2AsyncRedirect.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncRedirect.java
similarity index 88%
rename from httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2AsyncRedirect.java
rename to httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncRedirect.java
index 6185f73..ed23143 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2AsyncRedirect.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncRedirect.java
@@ -31,7 +31,7 @@ import java.util.Collection;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
-import org.apache.hc.client5.http.impl.async.Http2AsyncClientBuilder;
+import org.apache.hc.client5.http.impl.async.H2AsyncClientBuilder;
import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
import org.apache.hc.client5.testing.SSLTestContexts;
import org.apache.hc.core5.http.HttpVersion;
@@ -42,7 +42,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
-public class TestHttp2AsyncRedirect extends AbstractHttpAsyncRedirectsTest<CloseableHttpAsyncClient> {
+public class TestH2AsyncRedirect extends AbstractHttpAsyncRedirectsTest<CloseableHttpAsyncClient> {
@Parameterized.Parameters(name = "HTTP/2 {0}")
public static Collection<Object[]> protocols() {
@@ -52,9 +52,9 @@ public class TestHttp2AsyncRedirect extends AbstractHttpAsyncRedirectsTest<Close
});
}
- protected Http2AsyncClientBuilder clientBuilder;
+ protected H2AsyncClientBuilder clientBuilder;
- public TestHttp2AsyncRedirect(final URIScheme scheme) {
+ public TestH2AsyncRedirect(final URIScheme scheme) {
super(HttpVersion.HTTP_2, scheme);
}
@@ -63,7 +63,7 @@ public class TestHttp2AsyncRedirect extends AbstractHttpAsyncRedirectsTest<Close
@Override
protected void before() throws Throwable {
- clientBuilder = Http2AsyncClientBuilder.create()
+ clientBuilder = H2AsyncClientBuilder.create()
.setDefaultRequestConfig(RequestConfig.custom()
.setConnectionRequestTimeout(TIMEOUT)
.setConnectTimeout(TIMEOUT)
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2ClientAuthentication.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ClientAuthentication.java
similarity index 90%
rename from httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2ClientAuthentication.java
rename to httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ClientAuthentication.java
index 9ac9fc3..d209667 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp2ClientAuthentication.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ClientAuthentication.java
@@ -33,7 +33,7 @@ import org.apache.hc.client5.http.AuthenticationStrategy;
import org.apache.hc.client5.http.auth.AuthSchemeProvider;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
-import org.apache.hc.client5.http.impl.async.Http2AsyncClientBuilder;
+import org.apache.hc.client5.http.impl.async.H2AsyncClientBuilder;
import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager;
import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
import org.apache.hc.client5.testing.SSLTestContexts;
@@ -46,7 +46,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
-public class TestHttp2ClientAuthentication extends AbstractHttpAsyncClientAuthentication<CloseableHttpAsyncClient> {
+public class TestH2ClientAuthentication extends AbstractHttpAsyncClientAuthentication<CloseableHttpAsyncClient> {
@Parameterized.Parameters(name = "HTTP/2 {0}")
public static Collection<Object[]> protocols() {
@@ -56,7 +56,7 @@ public class TestHttp2ClientAuthentication extends AbstractHttpAsyncClientAuthen
});
}
- protected Http2AsyncClientBuilder clientBuilder;
+ protected H2AsyncClientBuilder clientBuilder;
protected PoolingAsyncClientConnectionManager connManager;
@Rule
@@ -64,7 +64,7 @@ public class TestHttp2ClientAuthentication extends AbstractHttpAsyncClientAuthen
@Override
protected void before() throws Throwable {
- clientBuilder = Http2AsyncClientBuilder.create()
+ clientBuilder = H2AsyncClientBuilder.create()
.setDefaultRequestConfig(RequestConfig.custom()
.setConnectionRequestTimeout(TIMEOUT)
.setConnectTimeout(TIMEOUT)
@@ -74,7 +74,7 @@ public class TestHttp2ClientAuthentication extends AbstractHttpAsyncClientAuthen
};
- public TestHttp2ClientAuthentication(final URIScheme scheme) {
+ public TestH2ClientAuthentication(final URIScheme scheme) {
super(scheme, HttpVersion.HTTP_2);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
similarity index 89%
rename from httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
rename to httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
index 6aa021f..204cf7f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
@@ -128,7 +128,7 @@ import org.apache.hc.core5.util.VersionInfo;
*
* @since 5.0
*/
-public class Http2AsyncClientBuilder {
+public class H2AsyncClientBuilder {
private static class RequestInterceptorEntry {
@@ -217,18 +217,18 @@ public class Http2AsyncClientBuilder {
private List<Closeable> closeables;
- public static Http2AsyncClientBuilder create() {
- return new Http2AsyncClientBuilder();
+ public static H2AsyncClientBuilder create() {
+ return new H2AsyncClientBuilder();
}
- protected Http2AsyncClientBuilder() {
+ protected H2AsyncClientBuilder() {
super();
}
/**
* Sets {@link H2Config} configuration.
*/
- public final Http2AsyncClientBuilder setH2Config(final H2Config h2Config) {
+ public final H2AsyncClientBuilder setH2Config(final H2Config h2Config) {
this.h2Config = h2Config;
return this;
}
@@ -236,7 +236,7 @@ public class Http2AsyncClientBuilder {
/**
* Sets {@link IOReactorConfig} configuration.
*/
- public final Http2AsyncClientBuilder setIOReactorConfig(final IOReactorConfig ioReactorConfig) {
+ public final H2AsyncClientBuilder setIOReactorConfig(final IOReactorConfig ioReactorConfig) {
this.ioReactorConfig = ioReactorConfig;
return this;
}
@@ -244,7 +244,7 @@ public class Http2AsyncClientBuilder {
/**
* Sets {@link CharCodingConfig} configuration.
*/
- public final Http2AsyncClientBuilder setCharCodingConfig(final CharCodingConfig charCodingConfig) {
+ public final H2AsyncClientBuilder setCharCodingConfig(final CharCodingConfig charCodingConfig) {
this.charCodingConfig = charCodingConfig;
return this;
}
@@ -253,7 +253,7 @@ public class Http2AsyncClientBuilder {
* Assigns {@link AuthenticationStrategy} instance for target
* host authentication.
*/
- public final Http2AsyncClientBuilder setTargetAuthenticationStrategy(
+ public final H2AsyncClientBuilder setTargetAuthenticationStrategy(
final AuthenticationStrategy targetAuthStrategy) {
this.targetAuthStrategy = targetAuthStrategy;
return this;
@@ -263,7 +263,7 @@ public class Http2AsyncClientBuilder {
* Assigns {@link AuthenticationStrategy} instance for proxy
* authentication.
*/
- public final Http2AsyncClientBuilder setProxyAuthenticationStrategy(
+ public final H2AsyncClientBuilder setProxyAuthenticationStrategy(
final AuthenticationStrategy proxyAuthStrategy) {
this.proxyAuthStrategy = proxyAuthStrategy;
return this;
@@ -272,7 +272,7 @@ public class Http2AsyncClientBuilder {
/**
* Adds this protocol interceptor to the head of the protocol processing list.
*/
- public final Http2AsyncClientBuilder addRequestInterceptorFirst(final HttpResponseInterceptor interceptor) {
+ public final H2AsyncClientBuilder addRequestInterceptorFirst(final HttpResponseInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
if (responseInterceptors == null) {
responseInterceptors = new LinkedList<>();
@@ -284,7 +284,7 @@ public class Http2AsyncClientBuilder {
/**
* Adds this protocol interceptor to the tail of the protocol processing list.
*/
- public final Http2AsyncClientBuilder addResponseInterceptorLast(final HttpResponseInterceptor interceptor) {
+ public final H2AsyncClientBuilder addResponseInterceptorLast(final HttpResponseInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
if (responseInterceptors == null) {
responseInterceptors = new LinkedList<>();
@@ -296,7 +296,7 @@ public class Http2AsyncClientBuilder {
/**
* Adds this execution interceptor before an existing interceptor.
*/
- public final Http2AsyncClientBuilder addExecInterceptorBefore(final String existing, final String name, final AsyncExecChainHandler interceptor) {
+ public final H2AsyncClientBuilder addExecInterceptorBefore(final String existing, final String name, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
Args.notBlank(name, "Name");
Args.notNull(interceptor, "Interceptor");
@@ -310,7 +310,7 @@ public class Http2AsyncClientBuilder {
/**
* Adds this execution interceptor after interceptor with the given name.
*/
- public final Http2AsyncClientBuilder addExecInterceptorAfter(final String existing, final String name, final AsyncExecChainHandler interceptor) {
+ public final H2AsyncClientBuilder addExecInterceptorAfter(final String existing, final String name, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
Args.notBlank(name, "Name");
Args.notNull(interceptor, "Interceptor");
@@ -324,7 +324,7 @@ public class Http2AsyncClientBuilder {
/**
* Replace an existing interceptor with the given name with new interceptor.
*/
- public final Http2AsyncClientBuilder replaceExecInterceptor(final String existing, final AsyncExecChainHandler interceptor) {
+ public final H2AsyncClientBuilder replaceExecInterceptor(final String existing, final AsyncExecChainHandler interceptor) {
Args.notBlank(existing, "Existing");
Args.notNull(interceptor, "Interceptor");
if (execInterceptors == null) {
@@ -337,7 +337,7 @@ public class Http2AsyncClientBuilder {
/**
* Add an interceptor to the head of the processing list.
*/
- public final Http2AsyncClientBuilder addExecInterceptorFirst(final String name, final AsyncExecChainHandler interceptor) {
+ public final H2AsyncClientBuilder addExecInterceptorFirst(final String name, final AsyncExecChainHandler interceptor) {
Args.notNull(name, "Name");
Args.notNull(interceptor, "Interceptor");
execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.FIRST, name, interceptor, null));
@@ -347,7 +347,7 @@ public class Http2AsyncClientBuilder {
/**
* Add an interceptor to the tail of the processing list.
*/
- public final Http2AsyncClientBuilder addExecInterceptorLast(final String name, final AsyncExecChainHandler interceptor) {
+ public final H2AsyncClientBuilder addExecInterceptorLast(final String name, final AsyncExecChainHandler interceptor) {
Args.notNull(name, "Name");
Args.notNull(interceptor, "Interceptor");
execInterceptors.add(new ExecInterceptorEntry(ExecInterceptorEntry.Postion.LAST, name, interceptor, null));
@@ -357,7 +357,7 @@ public class Http2AsyncClientBuilder {
/**
* Adds this protocol interceptor to the head of the protocol processing list.
*/
- public final Http2AsyncClientBuilder addRequestInterceptorFirst(final HttpRequestInterceptor interceptor) {
+ public final H2AsyncClientBuilder addRequestInterceptorFirst(final HttpRequestInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
if (requestInterceptors == null) {
requestInterceptors = new LinkedList<>();
@@ -369,7 +369,7 @@ public class Http2AsyncClientBuilder {
/**
* Adds this protocol interceptor to the tail of the protocol processing list.
*/
- public final Http2AsyncClientBuilder addResponseInterceptorLast(final HttpRequestInterceptor interceptor) {
+ public final H2AsyncClientBuilder addResponseInterceptorLast(final HttpRequestInterceptor interceptor) {
Args.notNull(interceptor, "Interceptor");
if (requestInterceptors == null) {
requestInterceptors = new LinkedList<>();
@@ -384,7 +384,7 @@ public class Http2AsyncClientBuilder {
* Please note this value can be overridden by the {@link #disableAutomaticRetries()}
* method.
*/
- public final Http2AsyncClientBuilder setRetryHandler(final HttpRequestRetryHandler retryHandler) {
+ public final H2AsyncClientBuilder setRetryHandler(final HttpRequestRetryHandler retryHandler) {
this.retryHandler = retryHandler;
return this;
}
@@ -396,7 +396,7 @@ public class Http2AsyncClientBuilder {
* method.
* </p>
*/
- public Http2AsyncClientBuilder setRedirectStrategy(final RedirectStrategy redirectStrategy) {
+ public H2AsyncClientBuilder setRedirectStrategy(final RedirectStrategy redirectStrategy) {
this.redirectStrategy = redirectStrategy;
return this;
}
@@ -404,7 +404,7 @@ public class Http2AsyncClientBuilder {
/**
* Assigns {@link SchemePortResolver} instance.
*/
- public final Http2AsyncClientBuilder setSchemePortResolver(final SchemePortResolver schemePortResolver) {
+ public final H2AsyncClientBuilder setSchemePortResolver(final SchemePortResolver schemePortResolver) {
this.schemePortResolver = schemePortResolver;
return this;
}
@@ -412,7 +412,7 @@ public class Http2AsyncClientBuilder {
/**
* Assigns {@link DnsResolver} instance.
*/
- public final Http2AsyncClientBuilder setDnsResolver(final DnsResolver dnsResolver) {
+ public final H2AsyncClientBuilder setDnsResolver(final DnsResolver dnsResolver) {
this.dnsResolver = dnsResolver;
return this;
}
@@ -420,7 +420,7 @@ public class Http2AsyncClientBuilder {
/**
* Assigns {@link TlsStrategy} instance.
*/
- public final Http2AsyncClientBuilder setTlsStrategy(final TlsStrategy tlsStrategy) {
+ public final H2AsyncClientBuilder setTlsStrategy(final TlsStrategy tlsStrategy) {
this.tlsStrategy = tlsStrategy;
return this;
}
@@ -428,7 +428,7 @@ public class Http2AsyncClientBuilder {
/**
* Assigns {@link ThreadFactory} instance.
*/
- public final Http2AsyncClientBuilder setThreadFactory(final ThreadFactory threadFactory) {
+ public final H2AsyncClientBuilder setThreadFactory(final ThreadFactory threadFactory) {
this.threadFactory = threadFactory;
return this;
}
@@ -436,7 +436,7 @@ public class Http2AsyncClientBuilder {
/**
* Assigns {@code User-Agent} value.
*/
- public final Http2AsyncClientBuilder setUserAgent(final String userAgent) {
+ public final H2AsyncClientBuilder setUserAgent(final String userAgent) {
this.userAgent = userAgent;
return this;
}
@@ -444,7 +444,7 @@ public class Http2AsyncClientBuilder {
/**
* Assigns default request header values.
*/
- public final Http2AsyncClientBuilder setDefaultHeaders(final Collection<? extends Header> defaultHeaders) {
+ public final H2AsyncClientBuilder setDefaultHeaders(final Collection<? extends Header> defaultHeaders) {
this.defaultHeaders = defaultHeaders;
return this;
}
@@ -452,7 +452,7 @@ public class Http2AsyncClientBuilder {
/**
* Assigns {@link HttpRoutePlanner} instance.
*/
- public final Http2AsyncClientBuilder setRoutePlanner(final HttpRoutePlanner routePlanner) {
+ public final H2AsyncClientBuilder setRoutePlanner(final HttpRoutePlanner routePlanner) {
this.routePlanner = routePlanner;
return this;
}
@@ -462,7 +462,7 @@ public class Http2AsyncClientBuilder {
* for request execution if not explicitly set in the client execution
* context.
*/
- public final Http2AsyncClientBuilder setDefaultCredentialsProvider(final CredentialsProvider credentialsProvider) {
+ public final H2AsyncClientBuilder setDefaultCredentialsProvider(final CredentialsProvider credentialsProvider) {
this.credentialsProvider = credentialsProvider;
return this;
}
@@ -472,7 +472,7 @@ public class Http2AsyncClientBuilder {
* be used for request execution if not explicitly set in the client execution
* context.
*/
- public final Http2AsyncClientBuilder setDefaultAuthSchemeRegistry(final Lookup<AuthSchemeProvider> authSchemeRegistry) {
+ public final H2AsyncClientBuilder setDefaultAuthSchemeRegistry(final Lookup<AuthSchemeProvider> authSchemeRegistry) {
this.authSchemeRegistry = authSchemeRegistry;
return this;
}
@@ -482,7 +482,7 @@ public class Http2AsyncClientBuilder {
* which will be used for request execution if not explicitly set in the client
* execution context.
*/
- public final Http2AsyncClientBuilder setDefaultCookieSpecRegistry(final Lookup<CookieSpecProvider> cookieSpecRegistry) {
+ public final H2AsyncClientBuilder setDefaultCookieSpecRegistry(final Lookup<CookieSpecProvider> cookieSpecRegistry) {
this.cookieSpecRegistry = cookieSpecRegistry;
return this;
}
@@ -491,7 +491,7 @@ public class Http2AsyncClientBuilder {
* Assigns default {@link CookieStore} instance which will be used for
* request execution if not explicitly set in the client execution context.
*/
- public final Http2AsyncClientBuilder setDefaultCookieStore(final CookieStore cookieStore) {
+ public final H2AsyncClientBuilder setDefaultCookieStore(final CookieStore cookieStore) {
this.cookieStore = cookieStore;
return this;
}
@@ -501,7 +501,7 @@ public class Http2AsyncClientBuilder {
* for request execution if not explicitly set in the client execution
* context.
*/
- public final Http2AsyncClientBuilder setDefaultRequestConfig(final RequestConfig config) {
+ public final H2AsyncClientBuilder setDefaultRequestConfig(final RequestConfig config) {
this.defaultRequestConfig = config;
return this;
}
@@ -510,7 +510,7 @@ public class Http2AsyncClientBuilder {
* Use system properties when creating and configuring default
* implementations.
*/
- public final Http2AsyncClientBuilder useSystemProperties() {
+ public final H2AsyncClientBuilder useSystemProperties() {
this.systemProperties = true;
return this;
}
@@ -518,7 +518,7 @@ public class Http2AsyncClientBuilder {
/**
* Disables automatic redirect handling.
*/
- public final Http2AsyncClientBuilder disableRedirectHandling() {
+ public final H2AsyncClientBuilder disableRedirectHandling() {
redirectHandlingDisabled = true;
return this;
}
@@ -526,7 +526,7 @@ public class Http2AsyncClientBuilder {
/**
* Disables automatic request recovery and re-execution.
*/
- public final Http2AsyncClientBuilder disableAutomaticRetries() {
+ public final H2AsyncClientBuilder disableAutomaticRetries() {
automaticRetriesDisabled = true;
return this;
}
@@ -534,7 +534,7 @@ public class Http2AsyncClientBuilder {
/**
* Disables state (cookie) management.
*/
- public final Http2AsyncClientBuilder disableCookieManagement() {
+ public final H2AsyncClientBuilder disableCookieManagement() {
this.cookieManagementDisabled = true;
return this;
}
@@ -542,7 +542,7 @@ public class Http2AsyncClientBuilder {
/**
* Disables authentication scheme caching.
*/
- public final Http2AsyncClientBuilder disableAuthCaching() {
+ public final H2AsyncClientBuilder disableAuthCaching() {
this.authCachingDisabled = true;
return this;
}
@@ -561,7 +561,7 @@ public class Http2AsyncClientBuilder {
* in the connection pool. Connections whose inactivity period exceeds this value will
* get closed and evicted from the pool.
*/
- public final Http2AsyncClientBuilder evictIdleConnections(final TimeValue maxIdleTime) {
+ public final H2AsyncClientBuilder evictIdleConnections(final TimeValue maxIdleTime) {
this.evictIdleConnections = true;
this.maxIdleTime = maxIdleTime;
return this;
@@ -595,7 +595,7 @@ public class Http2AsyncClientBuilder {
public CloseableHttpAsyncClient build() {
final NamedElementChain<AsyncExecChainHandler> execChainDefinition = new NamedElementChain<>();
execChainDefinition.addLast(
- new Http2AsyncMainClientExec(),
+ new H2AsyncMainClientExec(),
ChainElements.MAIN_TRANSPORT.name());
AuthenticationStrategy targetAuthStrategyCopy = this.targetAuthStrategy;
@@ -704,7 +704,7 @@ public class Http2AsyncClientBuilder {
}
final AsyncPushConsumerRegistry pushConsumerRegistry = new AsyncPushConsumerRegistry();
- final IOEventHandlerFactory ioEventHandlerFactory = new Http2AsyncClientEventHandlerFactory(
+ final IOEventHandlerFactory ioEventHandlerFactory = new H2AsyncClientEventHandlerFactory(
new DefaultHttpProcessor(new H2RequestContent(), new H2RequestTargetHost(), new H2RequestConnControl()),
new HandlerFactory<AsyncPushConsumer>() {
@@ -829,7 +829,7 @@ public class Http2AsyncClientBuilder {
}
closeablesCopy.add(connPool);
- return new InternalHttp2AsyncClient(
+ return new InternalH2AsyncClient(
ioReactor,
execChain,
pushConsumerRegistry,
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientEventHandlerFactory.java
similarity index 98%
rename from httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
rename to httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientEventHandlerFactory.java
index 4849ba3..6e3799b 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncClientEventHandlerFactory.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientEventHandlerFactory.java
@@ -50,7 +50,7 @@ import org.apache.hc.core5.util.Args;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-class Http2AsyncClientEventHandlerFactory implements IOEventHandlerFactory {
+class H2AsyncClientEventHandlerFactory implements IOEventHandlerFactory {
private final Logger wireLog = LoggerFactory.getLogger("org.apache.hc.client5.http.wire");
private final Logger headerLog = LoggerFactory.getLogger("org.apache.hc.client5.http.headers");
@@ -63,7 +63,7 @@ class Http2AsyncClientEventHandlerFactory implements IOEventHandlerFactory {
private final H2Config h2Config;
private final CharCodingConfig charCodingConfig;
- Http2AsyncClientEventHandlerFactory(
+ H2AsyncClientEventHandlerFactory(
final HttpProcessor httpProcessor,
final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory,
final H2Config h2Config,
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncMainClientExec.java
similarity index 99%
rename from httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
rename to httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncMainClientExec.java
index 422ce77..d5fbec8 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/Http2AsyncMainClientExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncMainClientExec.java
@@ -66,7 +66,7 @@ import org.slf4j.LoggerFactory;
*/
@Contract(threading = ThreadingBehavior.STATELESS)
@Internal
-public class Http2AsyncMainClientExec implements AsyncExecChainHandler {
+public class H2AsyncMainClientExec implements AsyncExecChainHandler {
private final Logger log = LoggerFactory.getLogger(getClass());
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
index 83c3546..9c38f24 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java
@@ -95,8 +95,8 @@ public final class HttpAsyncClients {
* {@link CloseableHttpAsyncClient} instances optimized for HTTP/2 protocol
* and message multiplexing
*/
- public static Http2AsyncClientBuilder customHttp2() {
- return Http2AsyncClientBuilder.create();
+ public static H2AsyncClientBuilder customHttp2() {
+ return H2AsyncClientBuilder.create();
}
/**
@@ -104,7 +104,7 @@ public final class HttpAsyncClients {
* optimized for HTTP/2 protocol and message multiplexing.
*/
public static CloseableHttpAsyncClient createHttp2Default() {
- return Http2AsyncClientBuilder.create().build();
+ return H2AsyncClientBuilder.create().build();
}
/**
@@ -112,7 +112,7 @@ public final class HttpAsyncClients {
* system properties optimized for HTTP/2 protocol and message multiplexing.
*/
public static CloseableHttpAsyncClient createHttp2System() {
- return Http2AsyncClientBuilder.create().useSystemProperties().build();
+ return H2AsyncClientBuilder.create().useSystemProperties().build();
}
private static HttpProcessor createMinimalProtocolProcessor() {
@@ -223,13 +223,13 @@ public final class HttpAsyncClients {
connManager);
}
- private static MinimalHttp2AsyncClient createMinimalHttp2AsyncClientImpl(
+ private static MinimalH2AsyncClient createMinimalHttp2AsyncClientImpl(
final IOEventHandlerFactory eventHandlerFactory,
final AsyncPushConsumerRegistry pushConsumerRegistry,
final IOReactorConfig ioReactorConfig,
final DnsResolver dnsResolver,
final TlsStrategy tlsStrategy) {
- return new MinimalHttp2AsyncClient(
+ return new MinimalH2AsyncClient(
eventHandlerFactory,
pushConsumerRegistry,
ioReactorConfig,
@@ -240,17 +240,17 @@ public final class HttpAsyncClients {
}
/**
- * Creates {@link MinimalHttp2AsyncClient} instance optimized for HTTP/2 multiplexing message
+ * Creates {@link MinimalH2AsyncClient} instance optimized for HTTP/2 multiplexing message
* transport without advanced HTTP protocol functionality.
*/
- public static MinimalHttp2AsyncClient createHttp2Minimal(
+ public static MinimalH2AsyncClient createHttp2Minimal(
final H2Config h2Config,
final IOReactorConfig ioReactorConfig,
final DnsResolver dnsResolver,
final TlsStrategy tlsStrategy) {
final AsyncPushConsumerRegistry pushConsumerRegistry = new AsyncPushConsumerRegistry();
return createMinimalHttp2AsyncClientImpl(
- new Http2AsyncClientEventHandlerFactory(
+ new H2AsyncClientEventHandlerFactory(
createMinimalProtocolProcessor(),
new HandlerFactory<AsyncPushConsumer>() {
@@ -269,10 +269,10 @@ public final class HttpAsyncClients {
}
/**
- * Creates {@link MinimalHttp2AsyncClient} instance optimized for HTTP/2 multiplexing message
+ * Creates {@link MinimalH2AsyncClient} instance optimized for HTTP/2 multiplexing message
* transport without advanced HTTP protocol functionality.
*/
- public static MinimalHttp2AsyncClient createHttp2Minimal(
+ public static MinimalH2AsyncClient createHttp2Minimal(
final H2Config h2Config,
final IOReactorConfig ioReactorConfig,
final TlsStrategy tlsStrategy) {
@@ -280,28 +280,28 @@ public final class HttpAsyncClients {
}
/**
- * Creates {@link MinimalHttp2AsyncClient} instance optimized for HTTP/2 multiplexing message
+ * Creates {@link MinimalH2AsyncClient} instance optimized for HTTP/2 multiplexing message
* transport without advanced HTTP protocol functionality.
*/
- public static MinimalHttp2AsyncClient createHttp2Minimal(
+ public static MinimalH2AsyncClient createHttp2Minimal(
final H2Config h2Config,
final IOReactorConfig ioReactorConfig) {
return createHttp2Minimal(h2Config, ioReactorConfig, DefaultClientTlsStrategy.getDefault());
}
/**
- * Creates {@link MinimalHttp2AsyncClient} instance optimized for HTTP/2 multiplexing message
+ * Creates {@link MinimalH2AsyncClient} instance optimized for HTTP/2 multiplexing message
* transport without advanced HTTP protocol functionality.
*/
- public static MinimalHttp2AsyncClient createHttp2Minimal(final H2Config h2Config) {
+ public static MinimalH2AsyncClient createHttp2Minimal(final H2Config h2Config) {
return createHttp2Minimal(h2Config, IOReactorConfig.DEFAULT);
}
/**
- * Creates {@link MinimalHttp2AsyncClient} instance optimized for HTTP/2 multiplexing message
+ * Creates {@link MinimalH2AsyncClient} instance optimized for HTTP/2 multiplexing message
* transport without advanced HTTP protocol functionality.
*/
- public static MinimalHttp2AsyncClient createHttp2Minimal() {
+ public static MinimalH2AsyncClient createHttp2Minimal() {
return createHttp2Minimal(H2Config.DEFAULT);
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncClient.java
similarity index 95%
rename from httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncClient.java
rename to httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncClient.java
index 323ef77..ff72109 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncClient.java
@@ -63,12 +63,12 @@ import org.apache.hc.core5.reactor.DefaultConnectingIOReactor;
*/
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
@Internal
-public final class InternalHttp2AsyncClient extends InternalAbstractHttpAsyncClient {
+public final class InternalH2AsyncClient extends InternalAbstractHttpAsyncClient {
private final HttpRoutePlanner routePlanner;
private final H2ConnPool connPool;
- InternalHttp2AsyncClient(
+ InternalH2AsyncClient(
final DefaultConnectingIOReactor ioReactor,
final AsyncExecChainElement execChain,
final AsyncPushConsumerRegistry pushConsumerRegistry,
@@ -89,7 +89,7 @@ public final class InternalHttp2AsyncClient extends InternalAbstractHttpAsyncCli
@Override
AsyncExecRuntime crerateAsyncExecRuntime(final HandlerFactory<AsyncPushConsumer> pushHandlerFactory) {
- return new InternalHttp2AsyncExecRuntime(log, connPool, pushHandlerFactory);
+ return new InternalH2AsyncExecRuntime(log, connPool, pushHandlerFactory);
}
@Override
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
similarity index 96%
rename from httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
rename to httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
index b835d66..6c9971f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalHttp2AsyncExecRuntime.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java
@@ -52,7 +52,7 @@ import org.apache.hc.core5.util.TimeValue;
import org.apache.hc.core5.util.Timeout;
import org.slf4j.Logger;
-class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
+class InternalH2AsyncExecRuntime implements AsyncExecRuntime {
private final Logger log;
private final H2ConnPool connPool;
@@ -60,7 +60,7 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
private final AtomicReference<Endpoint> sessionRef;
private volatile boolean reusable;
- InternalHttp2AsyncExecRuntime(
+ InternalH2AsyncExecRuntime(
final Logger log,
final H2ConnPool connPool,
final HandlerFactory<AsyncPushConsumer> pushHandlerFactory) {
@@ -95,7 +95,7 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
public void completed(final IOSession ioSession) {
sessionRef.set(new Endpoint(target, ioSession));
reusable = true;
- callback.completed(InternalHttp2AsyncExecRuntime.this);
+ callback.completed(InternalH2AsyncExecRuntime.this);
}
@Override
@@ -177,7 +177,7 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
public void completed(final IOSession ioSession) {
sessionRef.set(new Endpoint(target, ioSession));
reusable = true;
- callback.completed(InternalHttp2AsyncExecRuntime.this);
+ callback.completed(InternalH2AsyncExecRuntime.this);
}
@Override
@@ -267,7 +267,7 @@ class InternalHttp2AsyncExecRuntime implements AsyncExecRuntime {
@Override
public AsyncExecRuntime fork() {
- return new InternalHttp2AsyncExecRuntime(log, connPool, pushHandlerFactory);
+ return new InternalH2AsyncExecRuntime(log, connPool, pushHandlerFactory);
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalH2AsyncClient.java
similarity index 99%
rename from httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
rename to httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalH2AsyncClient.java
index 6f728e1..cad86c1 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttp2AsyncClient.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalH2AsyncClient.java
@@ -88,12 +88,12 @@ import org.apache.hc.core5.util.Timeout;
* @since 5.0
*/
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
-public final class MinimalHttp2AsyncClient extends AbstractMinimalHttpAsyncClientBase {
+public final class MinimalH2AsyncClient extends AbstractMinimalHttpAsyncClientBase {
private final H2ConnPool connPool;
private final ConnectionInitiator connectionInitiator;
- MinimalHttp2AsyncClient(
+ MinimalH2AsyncClient(
final IOEventHandlerFactory eventHandlerFactory,
final AsyncPushConsumerRegistry pushConsumerRegistry,
final IOReactorConfig reactorConfig,
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2FullDuplexExchange.java
similarity index 99%
rename from httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
rename to httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2FullDuplexExchange.java
index 9cc783d..f3ea5f5 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2FullDuplexExchange.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2FullDuplexExchange.java
@@ -58,7 +58,7 @@ import org.apache.hc.core5.util.Timeout;
/**
* This example demonstrates a full-duplex, streaming HTTP/2 message exchange.
*/
-public class AsyncClientHttp2FullDuplexExchange {
+public class AsyncClientH2FullDuplexExchange {
public static void main(final String[] args) throws Exception {
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2Multiplexing.java
similarity index 99%
rename from httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java
rename to httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2Multiplexing.java
index 729ca18..e10af5a 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2Multiplexing.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2Multiplexing.java
@@ -50,7 +50,7 @@ import org.apache.hc.core5.util.Timeout;
* This example demonstrates concurrent (multiplexed) execution of multiple
* HTTP/2 message exchanges.
*/
-public class AsyncClientHttp2Multiplexing {
+public class AsyncClientH2Multiplexing {
public static void main(final String[] args) throws Exception {
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2ServerPush.java
similarity index 99%
rename from httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
rename to httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2ServerPush.java
index 22dc283..12ec238 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientHttp2ServerPush.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientH2ServerPush.java
@@ -54,7 +54,7 @@ import org.apache.hc.core5.util.Timeout;
/**
* This example demonstrates handling of HTTP/2 message exchanges pushed by the server.
*/
-public class AsyncClientHttp2ServerPush {
+public class AsyncClientH2ServerPush {
public static void main(final String[] args) throws Exception {