Package io.inversion.lambda
Class AwsApiGatewayLambdaRequestStreamHandler
java.lang.Object
io.inversion.lambda.AwsApiGatewayLambdaRequestStreamHandler
- All Implemented Interfaces:
com.amazonaws.services.lambda.runtime.RequestStreamHandler
public class AwsApiGatewayLambdaRequestStreamHandler
extends Object
implements com.amazonaws.services.lambda.runtime.RequestStreamHandler
Adapter to run an Inversion API as an AWS Lambda behind an ApiGateway
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected io.inversion.ApibuildApi(io.inversion.Engine engine) Optional subclass override hook to supply your own custom wired up Api.protected io.inversion.EnginebuildEngine(String configProfile, String servletPath) Optional subclass override hook to allow for advanced Engine configuration.voidio.inversion.ApigetApi()io.inversion.EnginevoidhandleRequest(InputStream inputStream, OutputStream outputStream, com.amazonaws.services.lambda.runtime.Context context) booleanisDebug()voidsetApi(io.inversion.Api api) voidsetDebug(boolean debug) voidsetEngine(io.inversion.Engine engine) protected voidwriteResponse(io.inversion.Response res, OutputStream outputStream)
-
Field Details
-
engine
protected io.inversion.Engine engine -
api
protected io.inversion.Api api
-
-
Constructor Details
-
AwsApiGatewayLambdaRequestStreamHandler
public AwsApiGatewayLambdaRequestStreamHandler()
-
-
Method Details
-
handleRequest
public void handleRequest(InputStream inputStream, OutputStream outputStream, com.amazonaws.services.lambda.runtime.Context context) throws IOException - Specified by:
handleRequestin interfacecom.amazonaws.services.lambda.runtime.RequestStreamHandler- Throws:
IOException
-
buildEngine
Optional subclass override hook to allow for advanced Engine configuration.Simple embeddings can leave this alone. Complex embeddings can either set the engine via setEngine() or override this method to construct/configure as needed.
This default implementation constructs an Engine with the supplied configProfile and adds
apito it ifapiis not null.If
apiis null, it calls buildApi() which by default does nothing and is itself designed as an override hook.- Parameters:
configProfile- the configuration runtime profileservletPath- the servlet path- Returns:
- an Engine with an Api already set if one was supplied otherwise an empty Engine that will be configured via via Config/Wirer.
- See Also:
-
buildApi
protected io.inversion.Api buildApi(io.inversion.Engine engine) Optional subclass override hook to supply your own custom wired up Api.If you don't set your
apiviasetApi()and you don't overridebuildApi()to supply an Api or otherwise wire your custom Api and Engine in an overridden buildEngine() method, you will need to define your Api in inversion.properties files for autowiring via Config/Wirer.- Parameters:
engine- the engine that will host the Api- Returns:
- null unless you override this method to construct an Api.
- See Also:
-
writeResponse
protected void writeResponse(io.inversion.Response res, OutputStream outputStream) throws IOException - Throws:
IOException
-
debug
-
isDebug
public boolean isDebug() -
setDebug
public void setDebug(boolean debug) -
getEngine
public io.inversion.Engine getEngine() -
setEngine
public void setEngine(io.inversion.Engine engine) -
getApi
public io.inversion.Api getApi() -
setApi
public void setApi(io.inversion.Api api)
-