Class JerseyLambdaContainerHandler<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.jersey.JerseyLambdaContainerHandler<RequestType,​ResponseType>
Type Parameters:
RequestType - The type for the incoming Lambda event
ResponseType - The type for Lambda's return value

public class JerseyLambdaContainerHandler<RequestType,​ResponseType> extends AwsLambdaServletContainerHandler<RequestType,​ResponseType,​javax.servlet.http.HttpServletRequest,​AwsHttpServletResponse>
Jersey-specific implementation of the LambdaContainerHandler interface. Given a Jax-Rs application starts Jersey's ApplicationHandler and proxies requests and responses using the RequestReader and ResponseWriter objects. The reader and writer objects are inherited from the BaseLambdaContainerHandler object.
 
   public class LambdaHandler implements RequestHandler<AwsProxyRequest, AwsProxyResponse> {
     private ResourceConfig jerseyApplication = new ResourceConfig().packages("your.app.package");
     private JerseyLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> container = JerseyLambdaContainerHandler.getAwsProxyHandler(jerseyApplication);

     public AwsProxyResponse handleRequest(AwsProxyRequest awsProxyRequest, Context context) {
       return container.proxy(awsProxyRequest, context);
     }
   }
 
 
See Also:
LambdaContainerHandler
  • Constructor Details

    • JerseyLambdaContainerHandler

      public JerseyLambdaContainerHandler(Class<RequestType> requestTypeClass, Class<ResponseType> responseTypeClass, RequestReader<RequestType,​javax.servlet.http.HttpServletRequest> requestReader, ResponseWriter<AwsHttpServletResponse,​ResponseType> responseWriter, SecurityContextWriter<RequestType> securityContextWriter, ExceptionHandler<ResponseType> exceptionHandler, javax.ws.rs.core.Application jaxRsApplication)
      Private constructor for a LambdaContainer. Sets the application object, sets the ApplicationHandler, and initializes the application using the onStartup method.
      Parameters:
      requestTypeClass - The class for the expected event type
      responseTypeClass - The class for the output type
      requestReader - A request reader instance
      responseWriter - A response writer instance
      securityContextWriter - A security context writer object
      exceptionHandler - An exception handler
      jaxRsApplication - The JaxRs application
  • Method Details