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

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Constructor
    Description
    Default constructor.
    DefaultMicronautServlet(io.micronaut.context.ApplicationContext applicationContext)
    Constructor that takes an application context.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected io.micronaut.context.ApplicationContext
    buildApplicationContext(io.micronaut.context.ApplicationContextBuilder builder)
     
    void
     
    void
     
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 class jakarta.servlet.http.HttpServlet
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Servlet
      Overrides:
      destroy in class jakarta.servlet.GenericServlet
    • init

      public void init()
      Overrides:
      init in class jakarta.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