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 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:
      handleRequest in interface com.amazonaws.services.lambda.runtime.RequestStreamHandler
      Throws:
      IOException
    • buildEngine

      protected io.inversion.Engine buildEngine(String configProfile, 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 api to it if api is not null.

      If api is null, it calls buildApi() which by default does nothing and is itself designed as an override hook.

      Parameters:
      configProfile - the configuration runtime profile
      servletPath - 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 api via setApi() and you don't override buildApi() 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

      public void debug(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)