Package io.micronaut.servlet.engine
Class DefaultMicronautServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
io.micronaut.servlet.engine.DefaultMicronautServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
@WebServlet(name="micronaut",
loadOnStartup=1)
public class DefaultMicronautServlet
extends jakarta.servlet.http.HttpServlet
A servlet that initializes Micronaut and serves requests.
- Since:
- 1.0
- Author:
- graemerocher
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Attribute used to store the application context.static final String
The name of the servlet.Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD
-
Constructor Summary
ConstructorDescriptionDefault constructor.DefaultMicronautServlet
(io.micronaut.context.ApplicationContext applicationContext) Constructor that takes an application context. -
Method Summary
Modifier and TypeMethodDescriptionprotected io.micronaut.context.ApplicationContext
buildApplicationContext
(io.micronaut.context.ApplicationContextBuilder builder) void
destroy()
void
init()
protected io.micronaut.context.ApplicationContextBuilder
protected void
service
(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service
Methods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
-
Field Details
-
NAME
The name of the servlet.- See Also:
-
CONTEXT_ATTRIBUTE
Attribute used to store the application context.- See Also:
-
-
Constructor Details
-
DefaultMicronautServlet
@Inject public DefaultMicronautServlet(io.micronaut.context.ApplicationContext applicationContext) Constructor that takes an application context.- Parameters:
applicationContext
- The application context.
-
DefaultMicronautServlet
public DefaultMicronautServlet()Default constructor.
-
-
Method Details
-
service
protected void service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) - Overrides:
service
in classjakarta.servlet.http.HttpServlet
-
destroy
public void destroy()- Specified by:
destroy
in interfacejakarta.servlet.Servlet
- Overrides:
destroy
in classjakarta.servlet.GenericServlet
-
init
public void init()- Overrides:
init
in classjakarta.servlet.GenericServlet
-
buildApplicationContext
protected io.micronaut.context.ApplicationContext buildApplicationContext(io.micronaut.context.ApplicationContextBuilder builder) - Parameters:
builder
- The builder- Returns:
- The built context, must not null.
-
newApplicationContextBuilder
protected io.micronaut.context.ApplicationContextBuilder newApplicationContextBuilder()- Returns:
- A new
ApplicationContext
builder
-