HTTPCLIENT-2338: put compress exec interceptor after retry exec interceptor
This commit is contained in:
parent
12409713eb
commit
3b5c815f5c
|
@ -962,6 +962,22 @@ public class HttpClientBuilder {
|
|||
authCachingDisabled),
|
||||
ChainElement.PROTOCOL.name());
|
||||
|
||||
if (!contentCompressionDisabled) {
|
||||
if (contentDecoderMap != null) {
|
||||
final List<String> encodings = new ArrayList<>(contentDecoderMap.keySet());
|
||||
final RegistryBuilder<InputStreamFactory> b2 = RegistryBuilder.create();
|
||||
for (final Map.Entry<String, InputStreamFactory> entry: contentDecoderMap.entrySet()) {
|
||||
b2.register(entry.getKey(), entry.getValue());
|
||||
}
|
||||
final Registry<InputStreamFactory> decoderRegistry = b2.build();
|
||||
execChainDefinition.addFirst(
|
||||
new ContentCompressionExec(encodings, decoderRegistry, true),
|
||||
ChainElement.COMPRESS.name());
|
||||
} else {
|
||||
execChainDefinition.addFirst(new ContentCompressionExec(true), ChainElement.COMPRESS.name());
|
||||
}
|
||||
}
|
||||
|
||||
// Add request retry executor, if not disabled
|
||||
if (!automaticRetriesDisabled) {
|
||||
HttpRequestRetryStrategy retryStrategyCopy = this.retryStrategy;
|
||||
|
@ -991,22 +1007,6 @@ public class HttpClientBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
if (!contentCompressionDisabled) {
|
||||
if (contentDecoderMap != null) {
|
||||
final List<String> encodings = new ArrayList<>(contentDecoderMap.keySet());
|
||||
final RegistryBuilder<InputStreamFactory> b2 = RegistryBuilder.create();
|
||||
for (final Map.Entry<String, InputStreamFactory> entry: contentDecoderMap.entrySet()) {
|
||||
b2.register(entry.getKey(), entry.getValue());
|
||||
}
|
||||
final Registry<InputStreamFactory> decoderRegistry = b2.build();
|
||||
execChainDefinition.addFirst(
|
||||
new ContentCompressionExec(encodings, decoderRegistry, true),
|
||||
ChainElement.COMPRESS.name());
|
||||
} else {
|
||||
execChainDefinition.addFirst(new ContentCompressionExec(true), ChainElement.COMPRESS.name());
|
||||
}
|
||||
}
|
||||
|
||||
// Add redirect executor, if not disabled
|
||||
if (!redirectHandlingDisabled) {
|
||||
RedirectStrategy redirectStrategyCopy = this.redirectStrategy;
|
||||
|
|
Loading…
Reference in New Issue