Class SparkLambdaContainerHandler<RequestType,​ResponseType>

java.lang.Object
com.amazonaws.serverless.proxy.internal.LambdaContainerHandler<RequestType,​ResponseType,​ContainerRequestType,​ContainerResponseType>
com.amazonaws.serverless.proxy.internal.servlet.AwsLambdaServletContainerHandler<RequestType,​ResponseType,​javax.servlet.http.HttpServletRequest,​AwsHttpServletResponse>
com.amazonaws.serverless.proxy.spark.SparkLambdaContainerHandler<RequestType,​ResponseType>
Type Parameters:
RequestType - The request object used by the RequestReader implementation passed to the constructor
ResponseType - The response object produced by the ResponseWriter implementation in the constructor

public class SparkLambdaContainerHandler<RequestType,​ResponseType> extends AwsLambdaServletContainerHandler<RequestType,​ResponseType,​javax.servlet.http.HttpServletRequest,​AwsHttpServletResponse>
Implementation of the LambdaContainerHandler object that supports the Spark framework: http://sparkjava.com/

Because of the way this container is implemented, using reflection to change accessibility of methods in the Spark framework and inserting itself as the default embedded container, it is important that you initialize the Handler before declaring your spark routes.

This implementation uses the default AwsProxyHttpServletRequest and Response implementations.

 
     // always initialize the handler first
     SparkLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler =
             SparkLambdaContainerHandler.getAwsProxyHandler();

     get("/hello", (req, res) -> {
         res.status(200);
         res.body("Hello World");
     });