public class DefaultMicronautServlet
extends javax.servlet.http.HttpServlet
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONTEXT_ATTRIBUTE
Attribute used to store the application context.
|
static java.lang.String |
NAME
The name of the servlet.
|
Constructor and Description |
---|
DefaultMicronautServlet()
Default constructor.
|
DefaultMicronautServlet(io.micronaut.context.ApplicationContext applicationContext)
Constructor that takes an application context.
|
Modifier and Type | Method and Description |
---|---|
protected io.micronaut.context.ApplicationContext |
buildApplicationContext(io.micronaut.context.ApplicationContextBuilder builder) |
void |
destroy()
Called by the servlet container to indicate to a servlet that the
servlet is being taken out of service.
|
void |
init()
A convenience method which can be overridden so that there's no need
to call
super.init(config) . |
protected io.micronaut.context.ApplicationContextBuilder |
newApplicationContextBuilder() |
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Receives standard HTTP requests from the public
service method and dispatches
them to the do XXX methods defined in
this class. |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public static final java.lang.String NAME
public static final java.lang.String CONTEXT_ATTRIBUTE
public DefaultMicronautServlet(io.micronaut.context.ApplicationContext applicationContext)
applicationContext
- The application context.public DefaultMicronautServlet()
protected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
javax.servlet.http.HttpServlet
service
method and dispatches
them to the do
XXX methods defined in
this class. This method is an HTTP-specific version of the
Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
method. There's no
need to override this method.service
in class javax.servlet.http.HttpServlet
req
- the HttpServletRequest
object that
contains the request the client made of
the servletresp
- the HttpServletResponse
object that
contains the response the servlet returns
to the clientServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
public void destroy()
javax.servlet.GenericServlet
Servlet.destroy()
.destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
public void init()
javax.servlet.GenericServlet
super.init(config)
.
Instead of overriding GenericServlet.init(ServletConfig)
, simply override
this method and it will be called by
GenericServlet.init(ServletConfig config)
.
The ServletConfig
object can still be retrieved via GenericServlet.getServletConfig()
.
init
in class javax.servlet.GenericServlet
protected io.micronaut.context.ApplicationContext buildApplicationContext(io.micronaut.context.ApplicationContextBuilder builder)
builder
- The builderprotected io.micronaut.context.ApplicationContextBuilder newApplicationContextBuilder()
ApplicationContext
builder