Package io.micronaut.servlet.tomcat
Class TomcatFactory
java.lang.Object
io.micronaut.http.ssl.SslBuilder<SSLContext>
io.micronaut.servlet.engine.server.ServletServerFactory
io.micronaut.servlet.tomcat.TomcatFactory
Factory for the
Tomcat
instance.- Since:
- 1.0.0
- Author:
- graemerocher
-
Constructor Summary
ModifierConstructorDescriptionprotected
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. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
configureConnectors
(@NonNull org.apache.catalina.startup.Tomcat tomcat, @NonNull org.apache.catalina.connector.Connector httpConnector, @Nullable org.apache.catalina.connector.Connector httpsConnector) Configures the available connectors.protected void
configureServletInitializer
(org.apache.catalina.Context context, Collection<jakarta.servlet.ServletContainerInitializer> servletInitializers) Configure the Micronaut servlet initializer.protected @NonNull org.apache.catalina.startup.Tomcat
Create a new tomcat server.protected @NonNull org.apache.catalina.Context
newTomcatContext
(@NonNull org.apache.catalina.startup.Tomcat tomcat) Create a new context.protected org.apache.catalina.connector.Connector
sslConnector
(io.micronaut.http.ssl.SslConfiguration sslConfiguration) The HTTPS connector.protected org.apache.catalina.connector.Connector
protected org.apache.catalina.startup.Tomcat
tomcatServer
(org.apache.catalina.connector.Connector connector, @Nullable org.apache.catalina.connector.Connector httpsConnector, MicronautServletConfiguration configuration, Collection<jakarta.servlet.ServletContainerInitializer> servletInitializers) The Tomcat server bean.protected org.apache.catalina.startup.Tomcat
tomcatServer
(org.apache.catalina.connector.Connector connector, MicronautServletConfiguration configuration) The Tomcat server bean.Methods inherited from class io.micronaut.servlet.engine.server.ServletServerFactory
build, build, getApplicationContext, getConfiguredHost, getConfiguredPort, getContextPath, getEnvironment, getSslConfiguration, getStaticResourceConfigurations
Methods inherited from class io.micronaut.http.ssl.SslBuilder
getKeyManagerFactory, getKeyStore, getTrustManagerFactory, getTrustManagerFactory, getTrustStore, load
-
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 resolverserverConfiguration
- The server configsslConfiguration
- The SSL configapplicationContext
- The app contextstaticResourceConfigurations
- The static resource configs
-
-
Method Details
-
getServerConfiguration
- Overrides:
getServerConfiguration
in classServletServerFactory
- 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 connectorconfiguration
- 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 connectorhttpsConnector
- The HTTPS connectorsconfiguration
- The servlet configurationservletInitializers
- 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 contextservletInitializers
- 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 instancehttpConnector
- The HTTP connectorhttpsConnector
- 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
-