Class ServletHttpHandler<REQ,RES>

java.lang.Object
io.micronaut.servlet.http.ServletHttpHandler<REQ,RES>
Type Parameters:
REQ - The request object
RES - The response object
All Implemented Interfaces:
io.micronaut.context.LifeCycle<ServletHttpHandler<REQ,RES>>, Closeable, AutoCloseable
Direct Known Subclasses:
DefaultServletHttpHandler

public abstract class ServletHttpHandler<REQ,RES> extends Object implements AutoCloseable, io.micronaut.context.LifeCycle<ServletHttpHandler<REQ,RES>>
An HTTP handler that can deal with Serverless requests.
Since:
1.2.0
Author:
graemerocher
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
      Logger to be used by subclasses for logging.
    • applicationContext

      protected final io.micronaut.context.ApplicationContext applicationContext
  • Constructor Details

    • ServletHttpHandler

      protected ServletHttpHandler(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.core.convert.ConversionService conversionService)
      Default constructor.
      Parameters:
      applicationContext - The application context
      conversionService - The conversion service
  • Method Details

    • getApplicationContext

      public io.micronaut.context.ApplicationContext getApplicationContext()
      Returns:
      The application context for the function.
    • getMediaTypeCodecRegistry

      public io.micronaut.http.codec.MediaTypeCodecRegistry getMediaTypeCodecRegistry()
      Returns:
      The media type codec registry.
    • service

      public void service(REQ request, RES response)
      Handle the give native request and response.
      Parameters:
      request - The request
      response - The response
    • exchange

      public ServletExchange<REQ,RES> exchange(REQ request, RES response)
      Handle the give native request and response and return the ServletExchange object.
      Parameters:
      request - The request
      response - The response
      Returns:
      The ServletExchange object
    • exchange

      public ServletExchange<REQ,RES> exchange(ServletExchange<REQ,RES> exchange)
      Handle the give native request and response and return the ServletExchange object.
      Parameters:
      exchange - The exchange
      Returns:
      The ServletExchange object
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface io.micronaut.context.LifeCycle<REQ>
    • service

      public void service(ServletExchange<REQ,RES> exchange)
      Parameters:
      exchange - The exchange
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface io.micronaut.context.LifeCycle<REQ>
    • start

      @NonNull public @NonNull ServletHttpHandler<REQ,RES> start()
      Specified by:
      start in interface io.micronaut.context.LifeCycle<REQ>
    • stop

      @NonNull public @NonNull ServletHttpHandler<REQ,RES> stop()
      Specified by:
      stop in interface io.micronaut.context.LifeCycle<REQ>
    • createExchange

      protected abstract ServletExchange<REQ,RES> createExchange(REQ request, RES response)
      Creates the DefaultServletExchange object.
      Parameters:
      request - The request
      response - The response
      Returns:
      The exchange object