public final class MicronautLambdaContainerHandler extends AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>> implements io.micronaut.context.ApplicationContextProvider, java.io.Closeable, java.lang.AutoCloseable
lambdaContext, SERVER_INFO
Constructor and Description |
---|
MicronautLambdaContainerHandler()
Default constructor.
|
MicronautLambdaContainerHandler(io.micronaut.context.ApplicationContext applicationContext)
Constructor used to inject a preexisting
ApplicationContext . |
MicronautLambdaContainerHandler(io.micronaut.context.ApplicationContextBuilder applicationContextBuilder)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addByteArrayToStringConverter()
Adds a converter from byte array to string.
|
protected void |
addConverters()
Add converters to the Application environment.
|
void |
close() |
io.micronaut.context.ApplicationContext |
getApplicationContext() |
protected MicronautAwsProxyResponse<?> |
getContainerResponse(MicronautAwsProxyRequest<?> request,
java.util.concurrent.CountDownLatch latch)
Get the container response.
|
protected void |
handleRequest(MicronautAwsProxyRequest<?> containerRequest,
MicronautAwsProxyResponse<?> containerResponse,
com.amazonaws.services.lambda.runtime.Context lambdaContext)
Handle the request.
|
protected void |
initContainerState() |
void |
initialize()
Initialize the container.
|
protected com.fasterxml.jackson.databind.ObjectMapper |
objectMapper()
The object mapper.
|
protected com.fasterxml.jackson.databind.ObjectReader |
readerFor(java.lang.Class<com.amazonaws.serverless.proxy.model.AwsProxyRequest> requestClass)
Gets a reader for the given request class.
|
protected com.fasterxml.jackson.databind.ObjectWriter |
writerFor(java.lang.Class<com.amazonaws.serverless.proxy.model.AwsProxyResponse> responseClass)
Gets a writer for the given response class.
|
getContainerConfig, proxy, proxyStream, setLogFormatter, stripBasePath
public MicronautLambdaContainerHandler(io.micronaut.context.ApplicationContextBuilder applicationContextBuilder) throws com.amazonaws.serverless.exceptions.ContainerInitializationException
applicationContextBuilder
- The context buildercom.amazonaws.serverless.exceptions.ContainerInitializationException
- The exceptionpublic MicronautLambdaContainerHandler() throws com.amazonaws.serverless.exceptions.ContainerInitializationException
com.amazonaws.serverless.exceptions.ContainerInitializationException
- The exceptionpublic MicronautLambdaContainerHandler(io.micronaut.context.ApplicationContext applicationContext) throws com.amazonaws.serverless.exceptions.ContainerInitializationException
ApplicationContext
.applicationContext
- application contextcom.amazonaws.serverless.exceptions.ContainerInitializationException
- The exceptionpublic io.micronaut.context.ApplicationContext getApplicationContext()
getApplicationContext
in interface io.micronaut.context.ApplicationContextProvider
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper()
AbstractLambdaContainerHandler
objectMapper
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
protected com.fasterxml.jackson.databind.ObjectWriter writerFor(java.lang.Class<com.amazonaws.serverless.proxy.model.AwsProxyResponse> responseClass)
AbstractLambdaContainerHandler
writerFor
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
responseClass
- The response classprotected com.fasterxml.jackson.databind.ObjectReader readerFor(java.lang.Class<com.amazonaws.serverless.proxy.model.AwsProxyRequest> requestClass)
AbstractLambdaContainerHandler
readerFor
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
requestClass
- The request classprotected MicronautAwsProxyResponse<?> getContainerResponse(MicronautAwsProxyRequest<?> request, java.util.concurrent.CountDownLatch latch)
AbstractLambdaContainerHandler
getContainerResponse
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
request
- The requestlatch
- The count down latchpublic void initialize() throws com.amazonaws.serverless.exceptions.ContainerInitializationException
AbstractLambdaContainerHandler
initialize
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
com.amazonaws.serverless.exceptions.ContainerInitializationException
- when an error occursprotected void initContainerState()
protected void addConverters()
protected void addByteArrayToStringConverter()
protected void handleRequest(MicronautAwsProxyRequest<?> containerRequest, MicronautAwsProxyResponse<?> containerResponse, com.amazonaws.services.lambda.runtime.Context lambdaContext)
AbstractLambdaContainerHandler
handleRequest
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
containerRequest
- The container requestcontainerResponse
- The responselambdaContext
- The lambda contextpublic void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable