Class DefaultServletToAwsProxyResponseAdapter
java.lang.Object
io.micronaut.function.aws.proxy.test.DefaultServletToAwsProxyResponseAdapter
- All Implemented Interfaces:
ServletToAwsProxyResponseAdapter
@Singleton
public class DefaultServletToAwsProxyResponseAdapter
extends Object
implements ServletToAwsProxyResponseAdapter
DefaultImplementation of ServletToAwsProxyResponseAdapter.- Author:
- Sergio del Amo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Charsetvoidhandle(@NonNull io.micronaut.core.convert.ConversionService conversionService, @NonNull jakarta.servlet.http.HttpServletRequest request, @NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse awsProxyResponse, @NonNull jakarta.servlet.http.HttpServletResponse response) Writes the contents of aAPIGatewayV2HTTPResponseto aHttpServletResponse.protected @io.micronaut.core.annotation.Nullable byte[]parseBodyAsBytes(com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse awsProxyResponse) Returns the response's body bytes considering whether the body was Base64 encoded.
-
Constructor Details
-
DefaultServletToAwsProxyResponseAdapter
public DefaultServletToAwsProxyResponseAdapter()
-
-
Method Details
-
handle
public void handle(@NonNull @NonNull io.micronaut.core.convert.ConversionService conversionService, @NonNull @NonNull jakarta.servlet.http.HttpServletRequest request, @NonNull @NonNull com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse awsProxyResponse, @NonNull @NonNull jakarta.servlet.http.HttpServletResponse response) throws IOException Description copied from interface:ServletToAwsProxyResponseAdapterWrites the contents of aAPIGatewayV2HTTPResponseto aHttpServletResponse.- Specified by:
handlein interfaceServletToAwsProxyResponseAdapter- Parameters:
conversionService- The conversion servicerequest- Servlet RequestawsProxyResponse- The AWS proxy responseresponse- The Servlet Response- Throws:
IOException- can be thrown while writing the response
-
parseBodyAsBytes
@Nullable protected @io.micronaut.core.annotation.Nullable byte[] parseBodyAsBytes(com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPResponse awsProxyResponse) Returns the response's body bytes considering whether the body was Base64 encoded.- Parameters:
awsProxyResponse- The response- Returns:
- The response's body bytes.
-
getBodyCharset
- Returns:
- The charset used to read the response's body bytes.
-