Skip to content

Commit

Permalink
Merge pull request #32935 from Sgitario/32927
Browse files Browse the repository at this point in the history
Register GZIP interceptor for reflection when http compression is enable
  • Loading branch information
Sgitario authored Apr 27, 2023
2 parents 2c39693 + 985f9da commit 0baea80
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.jboss.jandex.MethodInfo;
import org.jboss.jandex.Type;
import org.jboss.logging.Logger;
import org.jboss.resteasy.reactive.client.interceptors.ClientGZIPDecodingInterceptor;
import org.jboss.resteasy.reactive.client.spi.MissingMessageBodyReaderErrorMessageContextualizer;
import org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames;
import org.jboss.resteasy.reactive.common.processor.transformation.AnnotationStore;
Expand Down Expand Up @@ -108,6 +109,7 @@ class RestClientReactiveProcessor {
private static final DotName KOTLIN_METADATA_ANNOTATION = DotName.createSimple("kotlin.Metadata");

private static final String DISABLE_SMART_PRODUCES_QUARKUS = "quarkus.rest-client.disable-smart-produces";
private static final String ENABLE_COMPRESSION = "quarkus.http.enable-compression";
private static final String KOTLIN_INTERFACE_DEFAULT_IMPL_SUFFIX = "$DefaultImpls";

private static final Set<DotName> SKIP_COPYING_ANNOTATIONS_TO_GENERATED_CLASS = Set.of(
Expand Down Expand Up @@ -352,6 +354,19 @@ AdditionalBeanBuildItem registerProviderBeans(CombinedIndexBuildItem combinedInd
return builder.build();
}

@BuildStep
void registerCompressionInterceptors(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
Boolean enableCompression = ConfigProvider.getConfig()
.getOptionalValue(ENABLE_COMPRESSION, Boolean.class)
.orElse(false);
if (enableCompression) {
reflectiveClasses.produce(ReflectiveClassBuildItem
.builder(ClientGZIPDecodingInterceptor.class)
.serialization(false)
.build());
}
}

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
void addRestClientBeans(Capabilities capabilities,
Expand Down

0 comments on commit 0baea80

Please sign in to comment.