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
FieldsModifier and TypeFieldDescriptionstatic final StringAttribute used to store the application context.static final StringThe name of the servlet.Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DefaultMicronautServlet(io.micronaut.context.ApplicationContext applicationContext) Constructor that takes an application context. -
Method Summary
Modifier and TypeMethodDescriptionprotected io.micronaut.context.ApplicationContextbuildApplicationContext(io.micronaut.context.ApplicationContextBuilder builder) voiddestroy()voidinit()protected io.micronaut.context.ApplicationContextBuilderprotected voidservice(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, init, isSensitiveHeader, serviceMethods 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:
servicein classjakarta.servlet.http.HttpServlet
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Servlet- Overrides:
destroyin classjakarta.servlet.GenericServlet
-
init
public void init()- Overrides:
initin 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
ApplicationContextbuilder
-