Class TomcatServer

java.lang.Object
io.micronaut.servlet.http.server.AbstractServletServer<org.apache.catalina.startup.Tomcat>
io.micronaut.servlet.tomcat.TomcatServer
All Implemented Interfaces:
io.micronaut.context.ApplicationContextLifeCycle<io.micronaut.runtime.server.EmbeddedServer>, io.micronaut.context.ApplicationContextProvider, io.micronaut.context.LifeCycle<io.micronaut.runtime.server.EmbeddedServer>, io.micronaut.runtime.EmbeddedApplication<io.micronaut.runtime.server.EmbeddedServer>, io.micronaut.runtime.graceful.GracefulShutdownCapable, io.micronaut.runtime.server.EmbeddedServer, Closeable, AutoCloseable

@Singleton public class TomcatServer extends AbstractServletServer<org.apache.catalina.startup.Tomcat>
Implementation of EmbeddedServer for Tomcat.
Since:
1.0.0
Author:
graemerocher
  • Constructor Summary

    Constructors
    Constructor
    Description
    TomcatServer(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, @Nullable io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.runtime.server.event.ServerShutdownEvent> serverShutdownEventPublisher, org.apache.catalina.startup.Tomcat tomcat)
    Default constructor.
    TomcatServer(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, org.apache.catalina.startup.Tomcat tomcat)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use the constructor that accepts an application event publisher instead.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    int
     
     
     
     
    boolean
     
    protected void
    Start the server.
    protected void
    Pauses every connector so that no new request is read from the network while requests already being processed run to completion.
    protected void
    Stop the server.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.runtime.EmbeddedApplication

    getEnvironment, isForceExit, isShutdownHookNeeded

    Methods inherited from interface io.micronaut.runtime.server.EmbeddedServer

    getContextURI, isKeepAlive, isServer

    Methods inherited from interface io.micronaut.context.LifeCycle

    close, refresh
  • Constructor Details

    • TomcatServer

      @Inject public TomcatServer(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, @Nullable io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.runtime.server.event.ServerShutdownEvent> serverShutdownEventPublisher, org.apache.catalina.startup.Tomcat tomcat)
      Default constructor.
      Parameters:
      applicationContext - The context
      applicationConfiguration - The configuration
      serverShutdownEventPublisher - ApplicationEventPublisher for the ServerShutdownEvent event.
      tomcat - The tomcat instance
    • TomcatServer

      @Deprecated(forRemoval=true, since="5.2.0") public TomcatServer(io.micronaut.context.ApplicationContext applicationContext, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, org.apache.catalina.startup.Tomcat tomcat)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the constructor that accepts an application event publisher instead.
      Default constructor.
      Parameters:
      applicationContext - The context
      applicationConfiguration - The configuration
      tomcat - The tomcat instance
  • Method Details

    • startServer

      protected void startServer() throws Exception
      Description copied from class: AbstractServletServer
      Start the server.
      Specified by:
      startServer in class AbstractServletServer<org.apache.catalina.startup.Tomcat>
      Throws:
      Exception - when an error occurred starting the server
    • stopServer

      protected void stopServer() throws Exception
      Description copied from class: AbstractServletServer
      Stop the server.
      Specified by:
      stopServer in class AbstractServletServer<org.apache.catalina.startup.Tomcat>
      Throws:
      Exception - when an error occurred stopping the server
    • stopAcceptingRequests

      protected void stopAcceptingRequests()
      Pauses every connector so that no new request is read from the network while requests already being processed run to completion.
      Overrides:
      stopAcceptingRequests in class AbstractServletServer<org.apache.catalina.startup.Tomcat>
    • getPort

      public int getPort()
    • getHost

      public String getHost()
    • getScheme

      public String getScheme()
    • getURL

      public URL getURL()
    • getURI

      public URI getURI()
    • isRunning

      public boolean isRunning()