Skip to content

Commit

Permalink
Ensure that AwsProxyRequestContext can be used with @context in RESTE…
Browse files Browse the repository at this point in the history
…asy Reactive

Fixes: quarkusio#23442
(cherry picked from commit fc790db)
  • Loading branch information
geoand authored and gsmet committed Feb 7, 2023
1 parent e0f6985 commit 13da23b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions extensions/amazon-lambda-rest/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-lambda-rest-event-server</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-server-spi-deployment</artifactId>
</dependency>
</dependencies>
<build>
<resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static io.vertx.core.file.impl.FileResolverImpl.CACHE_DIR_BASE_PROP_NAME;

import org.jboss.logging.Logger;
import org.jboss.jandex.DotName;

import io.quarkus.amazon.lambda.deployment.LambdaUtil;
import io.quarkus.amazon.lambda.deployment.ProvidedAmazonLambdaHandlerBuildItem;
Expand All @@ -23,6 +23,7 @@
import io.quarkus.amazon.lambda.http.model.Headers;
import io.quarkus.amazon.lambda.http.model.MultiValuedTreeMap;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
Expand All @@ -31,15 +32,16 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
import io.quarkus.resteasy.reactive.server.spi.ContextTypeBuildItem;
import io.quarkus.vertx.http.deployment.RequireVirtualHttpBuildItem;

public class AmazonLambdaHttpProcessor {
private static final Logger log = Logger.getLogger(AmazonLambdaHttpProcessor.class);
private static final DotName AWS_PROXY_REQUEST_CONTEXT = DotName.createSimple(AwsProxyRequestContext.class);

@BuildStep
public void setupCDI(BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
AdditionalBeanBuildItem.Builder builder = AdditionalBeanBuildItem.builder();
builder.addBeanClasses(AwsHttpContextProducers.class);
builder.addBeanClasses(AwsHttpContextProducers.class).setUnremovable();
additionalBeans.produce(builder.build());
}

Expand Down Expand Up @@ -112,4 +114,11 @@ public void generateScripts(OutputTargetBuildItem target,
.replace("${lambdaName}", lambdaName);
LambdaUtil.writeFile(target, "sam.native.yaml", output);
}

@BuildStep
public void resteasyReactiveIntegration(BuildProducer<ContextTypeBuildItem> contextTypeProducer,
BuildProducer<UnremovableBeanBuildItem> unremovableBeanProducer) {
contextTypeProducer.produce(new ContextTypeBuildItem(AWS_PROXY_REQUEST_CONTEXT));
unremovableBeanProducer.produce(UnremovableBeanBuildItem.beanTypes(AWS_PROXY_REQUEST_CONTEXT));
}
}

0 comments on commit 13da23b

Please sign in to comment.