Package io.micronaut.servlet.http
Class ServletHttpHandler<REQ,RES>
java.lang.Object
io.micronaut.servlet.http.ServletHttpHandler<REQ,RES>
- Type Parameters:
REQ- The request objectRES- 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 Summary
FieldsModifier and TypeFieldDescriptionprotected final io.micronaut.context.ApplicationContextprotected static final org.slf4j.LoggerLogger to be used by subclasses for logging. -
Constructor Summary
ConstructorsModifierConstructorDescriptionServletHttpHandler(io.micronaut.context.ApplicationContext applicationContext) Deprecated.protectedServletHttpHandler(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.core.convert.ConversionService conversionService) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected abstract ServletExchange<REQ,RES> createExchange(REQ request, RES response) Creates theDefaultServletExchangeobject.exchange(ServletExchange<REQ, RES> exchange) Handle the give native request and response and return theServletExchangeobject.Handle the give native request and response and return theServletExchangeobject.io.micronaut.context.ApplicationContextio.micronaut.http.codec.MediaTypeCodecRegistrybooleanvoidservice(ServletExchange<REQ, RES> exchange) Handles aDefaultServletExchange.voidHandle the give native request and response.@NonNull ServletHttpHandler<REQ,RES> start()@NonNull ServletHttpHandler<REQ,RES> stop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.context.LifeCycle
refresh
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger 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 contextconversionService- The conversion service
-
ServletHttpHandler
Deprecated.Default constructor.- Parameters:
applicationContext- The application context
-
-
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
Handle the give native request and response.- Parameters:
request- The requestresponse- The response
-
exchange
Handle the give native request and response and return theServletExchangeobject.- Parameters:
request- The requestresponse- The response- Returns:
- The
ServletExchangeobject
-
exchange
Handle the give native request and response and return theServletExchangeobject.- Parameters:
exchange- The exchange- Returns:
- The
ServletExchangeobject
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceio.micronaut.context.LifeCycle<REQ>
-
service
Handles aDefaultServletExchange.- Parameters:
exchange- The exchange
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceio.micronaut.context.LifeCycle<REQ>
-
start
- Specified by:
startin interfaceio.micronaut.context.LifeCycle<REQ>
-
stop
- Specified by:
stopin interfaceio.micronaut.context.LifeCycle<REQ>
-
createExchange
Creates theDefaultServletExchangeobject.- Parameters:
request- The requestresponse- The response- Returns:
- The exchange object
-
ServletHttpHandler(ApplicationContext, ConversionService)