Skip to content

Commit 43e231e

Browse files
authored
Merge pull request #50553 from geoand/#50492-rename
Rename `quarkus.rest-client.enable-compression` to `quarkus.rest-client.enable-response-decompression`
2 parents 5e1845e + 99a299c commit 43e231e

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

extensions/resteasy-classic/rest-client-config/runtime/src/main/java/io/quarkus/restclient/config/AbstractRestClientConfigBuilder.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import io.smallrye.config.ConfigValue;
2121
import io.smallrye.config.FallbackConfigSourceInterceptor;
2222
import io.smallrye.config.Priorities;
23+
import io.smallrye.config.RelocateConfigSourceInterceptor;
2324
import io.smallrye.config.SmallRyeConfigBuilder;
2425

2526
/**
@@ -163,6 +164,7 @@ public ConfigSourceInterceptor getInterceptor(final ConfigSourceInterceptorConte
163164
return new Relocates(relocates);
164165
}
165166
});
167+
builder.withInterceptors(new RenameConfigFallbackInterceptor(), new RenameConfigRelocateInterceptor());
166168
return builder;
167169
}
168170

@@ -416,4 +418,38 @@ private static int indexOfRestClient(final String name) {
416418
}
417419
return -1;
418420
}
421+
422+
private static class RenameConfigFallbackInterceptor extends FallbackConfigSourceInterceptor {
423+
private static final Function<String, String> COMPRESSION_FALLBACK = name -> {
424+
if (name.startsWith("quarkus.rest-client")) {
425+
int index = name.indexOf(".enable-response-decompression");
426+
if (index == -1) { // not the property we care about
427+
return name;
428+
}
429+
return name.substring(0, index) + ".enable-compression";
430+
}
431+
return name;
432+
};
433+
434+
public RenameConfigFallbackInterceptor() {
435+
super(COMPRESSION_FALLBACK);
436+
}
437+
}
438+
439+
private static class RenameConfigRelocateInterceptor extends RelocateConfigSourceInterceptor {
440+
private static final Function<String, String> COMPRESSION_RELOCATION = name -> {
441+
if (name.startsWith("quarkus.rest-client")) {
442+
int index = name.indexOf(".enable-compression");
443+
if (index == -1) { // not the property we care about
444+
return name;
445+
}
446+
return name.substring(0, index) + ".enable-response-decompression";
447+
}
448+
return name;
449+
};
450+
451+
public RenameConfigRelocateInterceptor() {
452+
super(COMPRESSION_RELOCATION);
453+
}
454+
}
419455
}

extensions/resteasy-classic/rest-client-config/runtime/src/main/java/io/quarkus/restclient/config/RestClientsConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ default Optional<String> uriReload() {
650650
* <p>
651651
* This property is not applicable to the RESTEasy Client.
652652
*/
653-
Optional<Boolean> enableCompression();
653+
Optional<Boolean> enableResponseDecompression();
654654

655655
/**
656656
* If the Application-Layer Protocol Negotiation is enabled, the client will negotiate which protocol to use over the

extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ private void configureCustomProperties(QuarkusRestClientBuilder builder) {
148148
: Optional.empty());
149149
builder.property(QuarkusRestClientProperties.MAX_CHUNK_SIZE, maxChunkSize.orElse(DEFAULT_MAX_CHUNK_SIZE));
150150

151-
Optional<Boolean> enableCompressions = oneOf(restClientConfig.enableCompression(), configRoot.enableCompression());
151+
Optional<Boolean> enableCompressions = oneOf(restClientConfig.enableResponseDecompression(),
152+
configRoot.enableCompression());
152153
if (enableCompressions.isPresent()) {
153154
builder.enableCompression(enableCompressions.get());
154155
}

0 commit comments

Comments
 (0)