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 java.lang.Object implements com.amazonaws.services.lambda.runtime.RequestStreamHandlerAdapter to run an Inversion API as an AWS Lambda behind an ApiGateway
-
-
Constructor Summary
Constructors Constructor Description AwsApiGatewayLambdaRequestStreamHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected io.inversion.ApibuildApi(io.inversion.Engine engine)Optional subclass override hook to supply your own custom wired up Api.protected io.inversion.EnginebuildEngine(java.lang.String configProfile, java.lang.String servletPath)Optional subclass override hook to allow for advanced Engine configuration.voiddebug(java.lang.String msg)io.inversion.ApigetApi()io.inversion.EnginegetEngine()voidhandleRequest(java.io.InputStream inputStream, java.io.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, java.io.OutputStream outputStream)
-
-
-
Method Detail
-
handleRequest
public void handleRequest(java.io.InputStream inputStream, java.io.OutputStream outputStream, com.amazonaws.services.lambda.runtime.Context context) throws java.io.IOException- Specified by:
handleRequestin interfacecom.amazonaws.services.lambda.runtime.RequestStreamHandler- Throws:
java.io.IOException
-
buildEngine
protected io.inversion.Engine buildEngine(java.lang.String configProfile, java.lang.String servletPath)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(io.inversion.Engine)
-
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:
buildEngine(java.lang.String, java.lang.String)
-
writeResponse
protected void writeResponse(io.inversion.Response res, java.io.OutputStream outputStream) throws java.io.IOException- Throws:
java.io.IOException
-
debug
public void debug(java.lang.String msg)
-
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)
-
-