Package com.amazonaws.serverless.proxy
Class RequestReader<RequestType,ContainerRequestType>
java.lang.Object
com.amazonaws.serverless.proxy.RequestReader<RequestType,ContainerRequestType>
- Type Parameters:
RequestType- The type for the AWS Lambda eventContainerRequestType- The type for the underlying container request object
- Direct Known Subclasses:
AwsHttpApiV2HttpServletRequestReader,AwsProxyHttpServletRequestReader
Implementations of the RequestReader object are used by container objects to transform the incoming Lambda event into
a request object that can be used by the underlying container. Developers can build custom implementation of this interface
to support other container types as well as custom event types. This library provides a default implementation of this
object that supports requests for the AWS_PROXY integration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key for the ALB context property in the PropertiesDelegate objectstatic final StringThe key for the API Gateway context property in the PropertiesDelegate objectstatic final StringThe key to store the entire API Gateway eventstatic final StringThe key for the API Gateway stage variables property in the PropertiesDelegate objectstatic final StringThe key for the HTTP API request context passed by the servicesstatic final StringThe key for the HTTP API proxy request eventstatic final StringThe key for the HTTP API stage variablesstatic final StringThe key for the JAX RS security context properties stored in the request attributesstatic final StringThe key for the AWS Lambda context property in the PropertiesDelegate object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Class<? extends RequestType>abstract ContainerRequestTypereadRequest(RequestType request, jakarta.ws.rs.core.SecurityContext securityContext, com.amazonaws.services.lambda.runtime.Context lambdaContext, ContainerConfig config) Reads the incoming event object and produces a populated request for the underlying containerprotected StringstripBasePath(String requestPath, ContainerConfig config) Strips the base path from the request path if the container configuration object requires it
-
Field Details
-
API_GATEWAY_CONTEXT_PROPERTY
The key for the API Gateway context property in the PropertiesDelegate object- See Also:
-
API_GATEWAY_STAGE_VARS_PROPERTY
The key for the API Gateway stage variables property in the PropertiesDelegate object- See Also:
-
ALB_CONTEXT_PROPERTY
The key for the ALB context property in the PropertiesDelegate object- See Also:
-
API_GATEWAY_EVENT_PROPERTY
The key to store the entire API Gateway event- See Also:
-
LAMBDA_CONTEXT_PROPERTY
The key for the AWS Lambda context property in the PropertiesDelegate object- See Also:
-
JAX_SECURITY_CONTEXT_PROPERTY
The key for the JAX RS security context properties stored in the request attributes- See Also:
-
HTTP_API_CONTEXT_PROPERTY
The key for the HTTP API request context passed by the services- See Also:
-
HTTP_API_STAGE_VARS_PROPERTY
The key for the HTTP API stage variables- See Also:
-
HTTP_API_EVENT_PROPERTY
The key for the HTTP API proxy request event- See Also:
-
-
Constructor Details
-
RequestReader
public RequestReader()
-
-
Method Details
-
readRequest
public abstract ContainerRequestType readRequest(RequestType request, jakarta.ws.rs.core.SecurityContext securityContext, com.amazonaws.services.lambda.runtime.Context lambdaContext, ContainerConfig config) throws InvalidRequestEventException Reads the incoming event object and produces a populated request for the underlying container- Parameters:
request- The incoming request objectsecurityContext- A jax-rs SecurityContext object (@see com.amazonaws.serverless.proxy.SecurityContextWriter)lambdaContext- The AWS Lambda context for the requestconfig- The container configuration object. This is passed in by the LambdaContainerHandler.- Returns:
- A valid request object for the underlying container
- Throws:
InvalidRequestEventException- This exception is thrown if anything goes wrong during the creation of the request object
-
getRequestClass
-
stripBasePath
Strips the base path from the request path if the container configuration object requires it- Parameters:
requestPath- The incoming request pathconfig- The container configuration object- Returns:
- The final request path
-