You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by mi...@apache.org on 2019/12/10 09:51:05 UTC
[httpcomponents-client] branch master updated: HTTPCLIENT-2031:
Don't use plural names for enums
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
The following commit(s) were added to refs/heads/master by this push:
new 6cff260 HTTPCLIENT-2031: Don't use plural names for enums
6cff260 is described below
commit 6cff260eff9831f40a4d5ba3481be35cbdf6815f
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Dec 5 22:06:17 2019 +0100
HTTPCLIENT-2031: Don't use plural names for enums
This closes #180
---
.../impl/cache/CachingH2AsyncClientBuilder.java | 4 ++--
.../impl/cache/CachingHttpAsyncClientBuilder.java | 4 ++--
.../http/impl/cache/CachingHttpClientBuilder.java | 4 ++--
.../impl/{ChainElements.java => ChainElement.java} | 2 +-
.../http/impl/async/H2AsyncClientBuilder.java | 14 +++++++-------
.../http/impl/async/HttpAsyncClientBuilder.java | 14 +++++++-------
.../http/impl/classic/HttpClientBuilder.java | 22 +++++++++++-----------
.../http/examples/AsyncClientInterceptors.java | 4 ++--
.../http/examples/AsyncClientMessageTrailers.java | 4 ++--
.../client5/http/examples/ClientInterceptors.java | 4 ++--
10 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingH2AsyncClientBuilder.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingH2AsyncClientBuilder.java
index 2dc11aa..055246e 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingH2AsyncClientBuilder.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingH2AsyncClientBuilder.java
@@ -38,7 +38,7 @@ import org.apache.hc.client5.http.cache.HttpAsyncCacheStorage;
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.ChainElement;
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;
@@ -168,7 +168,7 @@ public class CachingH2AsyncClientBuilder extends H2AsyncClientBuilder {
httpCache,
cacheRevalidator,
config);
- execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name());
+ execChainDefinition.addBefore(ChainElement.PROTOCOL.name(), cachingExec, ChainElement.CACHING.name());
}
}
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClientBuilder.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClientBuilder.java
index 7295347..869ac13 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClientBuilder.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpAsyncClientBuilder.java
@@ -38,7 +38,7 @@ import org.apache.hc.client5.http.cache.HttpAsyncCacheStorage;
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.ChainElement;
import org.apache.hc.client5.http.impl.async.HttpAsyncClientBuilder;
import org.apache.hc.client5.http.impl.schedule.ImmediateSchedulingStrategy;
import org.apache.hc.client5.http.schedule.SchedulingStrategy;
@@ -168,7 +168,7 @@ public class CachingHttpAsyncClientBuilder extends HttpAsyncClientBuilder {
httpCache,
cacheRevalidator,
config);
- execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name());
+ execChainDefinition.addBefore(ChainElement.PROTOCOL.name(), cachingExec, ChainElement.CACHING.name());
}
}
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClientBuilder.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClientBuilder.java
index 714b34c..5d6bf91 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClientBuilder.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CachingHttpClientBuilder.java
@@ -36,7 +36,7 @@ import org.apache.hc.client5.http.cache.HttpCacheInvalidator;
import org.apache.hc.client5.http.cache.HttpCacheStorage;
import org.apache.hc.client5.http.cache.ResourceFactory;
import org.apache.hc.client5.http.classic.ExecChainHandler;
-import org.apache.hc.client5.http.impl.ChainElements;
+import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.schedule.ImmediateSchedulingStrategy;
import org.apache.hc.client5.http.schedule.SchedulingStrategy;
@@ -161,7 +161,7 @@ public class CachingHttpClientBuilder extends HttpClientBuilder {
httpCache,
cacheRevalidator,
config);
- execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name());
+ execChainDefinition.addBefore(ChainElement.PROTOCOL.name(), cachingExec, ChainElement.CACHING.name());
}
}
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/ChainElements.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/ChainElement.java
similarity index 98%
rename from httpclient5/src/main/java/org/apache/hc/client5/http/impl/ChainElements.java
rename to httpclient5/src/main/java/org/apache/hc/client5/http/impl/ChainElement.java
index 9f034f5..3c9b9fb 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/ChainElements.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/ChainElement.java
@@ -32,7 +32,7 @@ package org.apache.hc.client5.http.impl;
*
* @since 5.0
*/
-public enum ChainElements {
+public enum ChainElement {
REDIRECT, BACK_OFF, RETRY, RETRY_SERVICE_UNAVAILABLE, RETRY_IO_ERROR, CACHING, PROTOCOL,
CONNECT, MAIN_TRANSPORT
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
index dab9a3b..501ece7 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java
@@ -53,7 +53,7 @@ import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.cookie.CookieSpecProvider;
import org.apache.hc.client5.http.cookie.CookieStore;
-import org.apache.hc.client5.http.impl.ChainElements;
+import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.CookieSpecSupport;
import org.apache.hc.client5.http.impl.DefaultAuthenticationStrategy;
import org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy;
@@ -609,7 +609,7 @@ public class H2AsyncClientBuilder {
final NamedElementChain<AsyncExecChainHandler> execChainDefinition = new NamedElementChain<>();
execChainDefinition.addLast(
new H2AsyncMainClientExec(),
- ChainElements.MAIN_TRANSPORT.name());
+ ChainElement.MAIN_TRANSPORT.name());
AuthenticationStrategy targetAuthStrategyCopy = this.targetAuthStrategy;
if (targetAuthStrategyCopy == null) {
@@ -635,7 +635,7 @@ public class H2AsyncClientBuilder {
new AsyncConnectExec(
new DefaultHttpProcessor(new RequestTargetHost(), new RequestUserAgent(userAgentCopy)),
proxyAuthStrategyCopy),
- ChainElements.CONNECT.name());
+ ChainElement.CONNECT.name());
final HttpProcessorBuilder b = HttpProcessorBuilder.create();
if (requestInterceptors != null) {
@@ -683,7 +683,7 @@ public class H2AsyncClientBuilder {
final HttpProcessor httpProcessor = b.build();
execChainDefinition.addFirst(
new AsyncProtocolExec(httpProcessor, targetAuthStrategyCopy, proxyAuthStrategyCopy),
- ChainElements.PROTOCOL.name());
+ ChainElement.PROTOCOL.name());
// Add request retry executor, if not disabled
if (!automaticRetriesDisabled) {
@@ -691,7 +691,7 @@ public class H2AsyncClientBuilder {
if (retryHandlerCopy != null) {
execChainDefinition.addFirst(
new AsyncRetryExec(retryHandlerCopy),
- ChainElements.RETRY_IO_ERROR.name());
+ ChainElement.RETRY_IO_ERROR.name());
} else {
HttpRequestRetryStrategy retryStrategyCopy = this.retryStrategy;
if (retryStrategyCopy == null) {
@@ -699,7 +699,7 @@ public class H2AsyncClientBuilder {
}
execChainDefinition.addFirst(
new AsyncHttpRequestRetryExec(retryStrategyCopy),
- ChainElements.RETRY.name());
+ ChainElement.RETRY.name());
}
}
@@ -720,7 +720,7 @@ public class H2AsyncClientBuilder {
}
execChainDefinition.addFirst(
new AsyncRedirectExec(routePlannerCopy, redirectStrategyCopy),
- ChainElements.REDIRECT.name());
+ ChainElement.REDIRECT.name());
}
final AsyncPushConsumerRegistry pushConsumerRegistry = new AsyncPushConsumerRegistry();
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 9178476..97784b8 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
@@ -54,7 +54,7 @@ import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.cookie.CookieSpecProvider;
import org.apache.hc.client5.http.cookie.CookieStore;
-import org.apache.hc.client5.http.impl.ChainElements;
+import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.CookieSpecSupport;
import org.apache.hc.client5.http.impl.DefaultAuthenticationStrategy;
import org.apache.hc.client5.http.impl.DefaultConnectionKeepAliveStrategy;
@@ -759,7 +759,7 @@ public class HttpAsyncClientBuilder {
final NamedElementChain<AsyncExecChainHandler> execChainDefinition = new NamedElementChain<>();
execChainDefinition.addLast(
new HttpAsyncMainClientExec(keepAliveStrategyCopy, userTokenHandlerCopy),
- ChainElements.MAIN_TRANSPORT.name());
+ ChainElement.MAIN_TRANSPORT.name());
AuthenticationStrategy targetAuthStrategyCopy = this.targetAuthStrategy;
if (targetAuthStrategyCopy == null) {
@@ -785,7 +785,7 @@ public class HttpAsyncClientBuilder {
new AsyncConnectExec(
new DefaultHttpProcessor(new RequestTargetHost(), new RequestUserAgent(userAgentCopy)),
proxyAuthStrategyCopy),
- ChainElements.CONNECT.name());
+ ChainElement.CONNECT.name());
final HttpProcessorBuilder b = HttpProcessorBuilder.create();
if (requestInterceptors != null) {
@@ -833,7 +833,7 @@ public class HttpAsyncClientBuilder {
final HttpProcessor httpProcessor = b.build();
execChainDefinition.addFirst(
new AsyncProtocolExec(httpProcessor, targetAuthStrategyCopy, proxyAuthStrategyCopy),
- ChainElements.PROTOCOL.name());
+ ChainElement.PROTOCOL.name());
// Add request retry executor, if not disabled
if (!automaticRetriesDisabled) {
@@ -841,7 +841,7 @@ public class HttpAsyncClientBuilder {
if (retryHandlerCopy != null) {
execChainDefinition.addFirst(
new AsyncRetryExec(retryHandlerCopy),
- ChainElements.RETRY_IO_ERROR.name());
+ ChainElement.RETRY_IO_ERROR.name());
} else {
HttpRequestRetryStrategy retryStrategyCopy = this.retryStrategy;
if (retryStrategyCopy == null) {
@@ -849,7 +849,7 @@ public class HttpAsyncClientBuilder {
}
execChainDefinition.addFirst(
new AsyncHttpRequestRetryExec(retryStrategyCopy),
- ChainElements.RETRY.name());
+ ChainElement.RETRY.name());
}
}
@@ -883,7 +883,7 @@ public class HttpAsyncClientBuilder {
}
execChainDefinition.addFirst(
new AsyncRedirectExec(routePlannerCopy, redirectStrategyCopy),
- ChainElements.REDIRECT.name());
+ ChainElement.REDIRECT.name());
}
List<Closeable> closeablesCopy = closeables != null ? new ArrayList<>(closeables) : null;
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
index 0dfef46..ddb3199 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
@@ -57,7 +57,7 @@ import org.apache.hc.client5.http.cookie.BasicCookieStore;
import org.apache.hc.client5.http.cookie.CookieSpecProvider;
import org.apache.hc.client5.http.cookie.CookieStore;
import org.apache.hc.client5.http.entity.InputStreamFactory;
-import org.apache.hc.client5.http.impl.ChainElements;
+import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.CookieSpecSupport;
import org.apache.hc.client5.http.impl.DefaultAuthenticationStrategy;
import org.apache.hc.client5.http.impl.DefaultConnectionKeepAliveStrategy;
@@ -812,13 +812,13 @@ public class HttpClientBuilder {
final NamedElementChain<ExecChainHandler> execChainDefinition = new NamedElementChain<>();
execChainDefinition.addLast(
new MainClientExec(connManagerCopy, reuseStrategyCopy, keepAliveStrategyCopy, userTokenHandlerCopy),
- ChainElements.MAIN_TRANSPORT.name());
+ ChainElement.MAIN_TRANSPORT.name());
execChainDefinition.addFirst(
new ConnectExec(
reuseStrategyCopy,
new DefaultHttpProcessor(new RequestTargetHost(), new RequestUserAgent(userAgentCopy)),
proxyAuthStrategyCopy),
- ChainElements.CONNECT.name());
+ ChainElement.CONNECT.name());
final HttpProcessorBuilder b = HttpProcessorBuilder.create();
if (requestInterceptors != null) {
@@ -868,7 +868,7 @@ public class HttpClientBuilder {
final HttpProcessor httpProcessor = b.build();
execChainDefinition.addFirst(
new ProtocolExec(httpProcessor, targetAuthStrategyCopy, proxyAuthStrategyCopy),
- ChainElements.PROTOCOL.name());
+ ChainElement.PROTOCOL.name());
// Add request retry executor, if not disabled
if (!automaticRetriesDisabled) {
@@ -877,7 +877,7 @@ public class HttpClientBuilder {
if (retryHandlerCopy != null) {
execChainDefinition.addFirst(
new RetryExec(retryHandlerCopy),
- ChainElements.RETRY_IO_ERROR.name());
+ ChainElement.RETRY_IO_ERROR.name());
} else {
HttpRequestRetryStrategy retryStrategyCopy = this.retryStrategy;
if (retryStrategyCopy == null) {
@@ -885,7 +885,7 @@ public class HttpClientBuilder {
}
execChainDefinition.addFirst(
new HttpRequestRetryExec(retryStrategyCopy),
- ChainElements.RETRY.name());
+ ChainElement.RETRY.name());
}
}
@@ -910,7 +910,7 @@ public class HttpClientBuilder {
if (serviceUnavailStrategyCopy != null) {
execChainDefinition.addFirst(
new ServiceUnavailableRetryExec(serviceUnavailStrategyCopy),
- ChainElements.RETRY_SERVICE_UNAVAILABLE.name());
+ ChainElement.RETRY_SERVICE_UNAVAILABLE.name());
}
// Add redirect executor, if not disabled
@@ -921,7 +921,7 @@ public class HttpClientBuilder {
}
execChainDefinition.addFirst(
new RedirectExec(routePlannerCopy, redirectStrategyCopy),
- ChainElements.REDIRECT.name());
+ ChainElement.REDIRECT.name());
}
if (!contentCompressionDisabled) {
@@ -934,18 +934,18 @@ public class HttpClientBuilder {
final Registry<InputStreamFactory> decoderRegistry = b2.build();
execChainDefinition.addFirst(
new ContentCompressionExec(encodings, decoderRegistry, true),
- ChainElements.REDIRECT.name());
+ ChainElement.REDIRECT.name());
} else {
execChainDefinition.addFirst(
new ContentCompressionExec(true),
- ChainElements.REDIRECT.name());
+ ChainElement.REDIRECT.name());
}
}
// Optionally, add connection back-off executor
if (this.backoffManager != null && this.connectionBackoffStrategy != null) {
execChainDefinition.addFirst(new BackoffStrategyExec(this.connectionBackoffStrategy, this.backoffManager),
- ChainElements.BACK_OFF.name());
+ ChainElement.BACK_OFF.name());
}
if (execInterceptors != null) {
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java
index 82b5ff2..3f2255c 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java
@@ -39,7 +39,7 @@ import org.apache.hc.client5.http.async.AsyncExecChainHandler;
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;
-import org.apache.hc.client5.http.impl.ChainElements;
+import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.core5.concurrent.FutureCallback;
@@ -92,7 +92,7 @@ public class AsyncClientInterceptors {
// Simulate a 404 response for some requests without passing the message down to the backend
- .addExecInterceptorAfter(ChainElements.PROTOCOL.name(), "custom", new AsyncExecChainHandler() {
+ .addExecInterceptorAfter(ChainElement.PROTOCOL.name(), "custom", new AsyncExecChainHandler() {
@Override
public void execute(
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 d9201ce..bbf247a 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
@@ -35,7 +35,7 @@ import org.apache.hc.client5.http.async.AsyncExecChain;
import org.apache.hc.client5.http.async.AsyncExecChainHandler;
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;
+import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.async.HttpAsyncClients;
import org.apache.hc.core5.concurrent.FutureCallback;
@@ -65,7 +65,7 @@ public class AsyncClientMessageTrailers {
final CloseableHttpAsyncClient client = HttpAsyncClients.custom()
.setIOReactorConfig(ioReactorConfig)
- .addExecInterceptorAfter(ChainElements.PROTOCOL.name(), "custom", new AsyncExecChainHandler() {
+ .addExecInterceptorAfter(ChainElement.PROTOCOL.name(), "custom", new AsyncExecChainHandler() {
@Override
public void execute(
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java
index 72dce94..340aa93 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java
@@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLong;
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.impl.ChainElements;
+import org.apache.hc.client5.http.impl.ChainElement;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
@@ -77,7 +77,7 @@ public class ClientInterceptors {
// Simulate a 404 response for some requests without passing the message down to the backend
- .addExecInterceptorAfter(ChainElements.PROTOCOL.name(), "custom", new ExecChainHandler() {
+ .addExecInterceptorAfter(ChainElement.PROTOCOL.name(), "custom", new ExecChainHandler() {
@Override
public ClassicHttpResponse execute(