Class TomcatFactory

java.lang.Object
io.micronaut.http.ssl.SslBuilder<SSLContext>
io.micronaut.servlet.engine.server.ServletServerFactory
io.micronaut.servlet.tomcat.TomcatFactory

@Factory public class TomcatFactory extends ServletServerFactory
Factory for the Tomcat instance.
Since:
1.0.0
Author:
graemerocher
  • Constructor Details

    • TomcatFactory

      protected TomcatFactory(io.micronaut.core.io.ResourceResolver resourceResolver, TomcatConfiguration serverConfiguration, io.micronaut.http.ssl.SslConfiguration sslConfiguration, io.micronaut.context.ApplicationContext applicationContext, List<ServletStaticResourceConfiguration> staticResourceConfigurations)
      Default constructor.
      Parameters:
      resourceResolver - The resource resolver
      serverConfiguration - The server config
      sslConfiguration - The SSL config
      applicationContext - The app context
      staticResourceConfigurations - The static resource configs
  • Method Details

    • getServerConfiguration

      public TomcatConfiguration getServerConfiguration()
      Overrides:
      getServerConfiguration in class ServletServerFactory
      Returns:
      The server config
    • tomcatServer

      protected org.apache.catalina.startup.Tomcat tomcatServer(org.apache.catalina.connector.Connector connector, MicronautServletConfiguration configuration)
      The Tomcat server bean.
      Parameters:
      connector - The connector
      configuration - The servlet configuration
      Returns:
      The Tomcat server
    • tomcatServer

      @Singleton @Primary protected org.apache.catalina.startup.Tomcat tomcatServer(org.apache.catalina.connector.Connector connector, @Named("HTTPS") @Nullable @Nullable org.apache.catalina.connector.Connector httpsConnector, MicronautServletConfiguration configuration, Collection<jakarta.servlet.ServletContainerInitializer> servletInitializers)
      The Tomcat server bean.
      Parameters:
      connector - The connector
      httpsConnector - The HTTPS connectors
      configuration - The servlet configuration
      servletInitializers - The servlet initializer
      Returns:
      The Tomcat server
    • configureServletInitializer

      protected void configureServletInitializer(org.apache.catalina.Context context, Collection<jakarta.servlet.ServletContainerInitializer> servletInitializers)
      Configure the Micronaut servlet initializer.
      Parameters:
      context - The context
      servletInitializers - The initializers
    • configureConnectors

      protected void configureConnectors(@NonNull @NonNull org.apache.catalina.startup.Tomcat tomcat, @NonNull @NonNull org.apache.catalina.connector.Connector httpConnector, @Nullable @Nullable org.apache.catalina.connector.Connector httpsConnector)
      Configures the available connectors.
      Parameters:
      tomcat - The tomcat instance
      httpConnector - The HTTP connector
      httpsConnector - The HTTPS connector
    • newTomcatContext

      @NonNull protected @NonNull org.apache.catalina.Context newTomcatContext(@NonNull @NonNull org.apache.catalina.startup.Tomcat tomcat)
      Create a new context.
      Parameters:
      tomcat - The tomcat instance
      Returns:
      The context
    • newTomcat

      @NonNull protected @NonNull org.apache.catalina.startup.Tomcat newTomcat()
      Create a new tomcat server.
      Returns:
      The tomcat server
    • tomcatConnector

      @Singleton @Primary protected org.apache.catalina.connector.Connector tomcatConnector()
      Returns:
      Create the connector.
    • sslConnector

      @Singleton @Named("HTTPS") @Requires(property="micronaut.ssl.enabled", value="true") protected org.apache.catalina.connector.Connector sslConnector(io.micronaut.http.ssl.SslConfiguration sslConfiguration)
      The HTTPS connector.
      Parameters:
      sslConfiguration - The SSL configuration.
      Returns:
      The SSL connector