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.ApplicationContext
protected static final org.slf4j.Logger
Logger to be used by subclasses for logging. -
Constructor Summary
ConstructorsModifierConstructorDescriptionServletHttpHandler
(io.micronaut.context.ApplicationContext applicationContext) Deprecated.protected
ServletHttpHandler
(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.core.convert.ConversionService conversionService) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected abstract ServletExchange<REQ,
RES> createExchange
(REQ request, RES response) Creates theDefaultServletExchange
object.exchange
(ServletExchange<REQ, RES> exchange) Handle the give native request and response and return theServletExchange
object.Handle the give native request and response and return theServletExchange
object.io.micronaut.context.ApplicationContext
io.micronaut.http.codec.MediaTypeCodecRegistry
boolean
void
service
(ServletExchange<REQ, RES> exchange) Handles aDefaultServletExchange
.void
Handle the give native request and response.start()
stop()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 theServletExchange
object.- Parameters:
request
- The requestresponse
- The response- Returns:
- The
ServletExchange
object
-
exchange
Handle the give native request and response and return theServletExchange
object.- Parameters:
exchange
- The exchange- Returns:
- The
ServletExchange
object
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceio.micronaut.context.LifeCycle<REQ>
-
service
Handles aDefaultServletExchange
.- Parameters:
exchange
- The exchange
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceio.micronaut.context.LifeCycle<REQ>
-
start
- Specified by:
start
in interfaceio.micronaut.context.LifeCycle<REQ>
-
stop
- Specified by:
stop
in interfaceio.micronaut.context.LifeCycle<REQ>
-
createExchange
Creates theDefaultServletExchange
object.- Parameters:
request
- The requestresponse
- The response- Returns:
- The exchange object
-
ServletHttpHandler(ApplicationContext, ConversionService)