Class JettyFactory

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

@Factory public class JettyFactory extends ServletServerFactory
Factory for the Jetty server.
Since:
1.0
Author:
graemerocher
  • Field Details

  • Constructor Details

    • JettyFactory

      public JettyFactory(io.micronaut.core.io.ResourceResolver resourceResolver, JettyConfiguration 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

    • jettyServer

      protected org.eclipse.jetty.server.Server jettyServer(io.micronaut.context.ApplicationContext applicationContext, MicronautServletConfiguration configuration, JettyConfiguration.JettySslConfiguration jettySslConfiguration)
      Builds the Jetty server bean.
      Parameters:
      applicationContext - This application context
      configuration - The servlet configuration
      jettySslConfiguration - The Jetty SSL config
      Returns:
      The Jetty server bean
    • jettyServer

      @Singleton @Primary protected org.eclipse.jetty.server.Server jettyServer(io.micronaut.context.ApplicationContext applicationContext, MicronautServletConfiguration configuration, JettyConfiguration.JettySslConfiguration jettySslConfiguration, Collection<jakarta.servlet.ServletContainerInitializer> servletContainerInitializers)
      Builds the Jetty server bean.
      Parameters:
      applicationContext - This application context
      configuration - The servlet configuration
      jettySslConfiguration - The Jetty SSL config
      servletContainerInitializers - The micronaut servlet initializer
      Returns:
      The Jetty server bean
    • newHttpConnector

      @NonNull protected @NonNull org.eclipse.jetty.server.ServerConnector newHttpConnector(@NonNull @NonNull org.eclipse.jetty.server.Server server, @NonNull @NonNull String host, @NonNull @NonNull Integer port)
      Create the HTTP connector.
      Parameters:
      server - The server
      host - The host
      port - The port
      Returns:
      The server connector.
    • newHttpsConnector

      @NonNull protected @NonNull org.eclipse.jetty.server.ServerConnector newHttpsConnector(@NonNull @NonNull org.eclipse.jetty.server.Server server, @NonNull @NonNull io.micronaut.http.ssl.SslConfiguration sslConfiguration, @NonNull JettyConfiguration.JettySslConfiguration jettySslConfiguration)
      Create the HTTPS connector.
      Parameters:
      server - The server
      sslConfiguration - The SSL configuration
      jettySslConfiguration - The Jetty SSL configuration
      Returns:
      The server connector
    • configureServletInitializer

      protected void configureServletInitializer(org.eclipse.jetty.server.Server server, org.eclipse.jetty.servlet.ServletContextHandler contextHandler, Collection<jakarta.servlet.ServletContainerInitializer> servletContainerInitializers)
      Configures the servlet initializer.
      Parameters:
      server - The server
      contextHandler - The context handler
      servletContainerInitializers - The servlet initializers
    • newJettyContext

      @NonNull protected @NonNull org.eclipse.jetty.servlet.ServletContextHandler newJettyContext(@NonNull @NonNull org.eclipse.jetty.server.Server server, @NonNull @NonNull String contextPath)
      Create the Jetty context.
      Parameters:
      server - The server
      contextPath - The context path
      Returns:
      The handler
    • configureConnectors

      protected void configureConnectors(@NonNull @NonNull org.eclipse.jetty.server.Server server, @NonNull @NonNull org.eclipse.jetty.server.ServerConnector http, @Nullable @Nullable org.eclipse.jetty.server.ServerConnector https)
      Configures the server connectors.
      Parameters:
      server - The server
      http - The HTTP connector
      https - The HTTPS connector if configured.
    • newServer

      @NonNull protected @NonNull org.eclipse.jetty.server.Server newServer(@NonNull @NonNull io.micronaut.context.ApplicationContext applicationContext, @NonNull @NonNull MicronautServletConfiguration configuration)
      Create a new server instance.
      Parameters:
      applicationContext - The application context
      configuration - The configuration
      Returns:
      The server