From 55f53e0dd59840a5582780c993b1345b0053c8db Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 11 Apr 2023 00:50:31 +0200 Subject: [PATCH] Enabled GZip support (but don't use it as class annotation, otherwise constructor injection will fail) --- .../banking/epcqrcode/rest/EpcQrCodeResource.kt | 14 ++++++++++---- .../src/main/resources/application.properties | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/EpcQrCodeResource.kt b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/EpcQrCodeResource.kt index 5103fc3..472a4b4 100644 --- a/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/EpcQrCodeResource.kt +++ b/EpcQrCodeRest/src/main/kotlin/net/codinux/banking/epcqrcode/rest/EpcQrCodeResource.kt @@ -10,6 +10,7 @@ import org.eclipse.microprofile.openapi.annotations.media.Schema import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody import org.eclipse.microprofile.openapi.annotations.responses.APIResponse import org.eclipse.microprofile.openapi.annotations.tags.Tag +import org.jboss.resteasy.annotations.GZIP import org.slf4j.LoggerFactory import java.util.* import javax.inject.Inject @@ -20,11 +21,16 @@ import javax.ws.rs.core.Response @Path("/epcqrcode/v1") @Produces(MediaType.APPLICATION_JSON) +@GZIP @Tag(name = "EPC QR Code") -class EpcQrCodeResource( - @Inject private val service: EpcQrCodeService, - @Inject private val htmlService: HtmlService -) { +class EpcQrCodeResource { + + // after adding GZip support compiler didn't like constructor injection anymore, so i switched to property injection + @Inject + private lateinit var service: EpcQrCodeService + + @Inject + internal lateinit var htmlService: HtmlService private val log = LoggerFactory.getLogger(EpcQrCodeResource::class.java) diff --git a/EpcQrCodeRest/src/main/resources/application.properties b/EpcQrCodeRest/src/main/resources/application.properties index 553a752..e243a81 100644 --- a/EpcQrCodeRest/src/main/resources/application.properties +++ b/EpcQrCodeRest/src/main/resources/application.properties @@ -5,6 +5,9 @@ quarkus.http.port=8080 quarkus.http.cors=true +quarkus.resteasy.gzip.enabled=true +quarkus.resteasy.gzip.max-input=10M + # disable this output: # Press [h] for more options>