Class WebServerConfig.BuilderBase<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig>

java.lang.Object
io.helidon.webserver.ListenerConfig.BuilderBase<BUILDER,PROTOTYPE>
io.helidon.webserver.WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
WebServerConfig.Builder
Enclosing interface:
WebServerConfig

public abstract static class WebServerConfig.BuilderBase<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig> extends ListenerConfig.BuilderBase<BUILDER,PROTOTYPE> implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for WebServerConfig.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(WebServerConfig prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(WebServerConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • routing

      public BUILDER routing(String socket, Consumer<HttpRouting.Builder> consumer)
      Add Http routing for an additional socket.
      Parameters:
      socket - name of the socket
      consumer - HTTP Routing for the given socket name
      Returns:
      updated builder instance
    • routing

      public BUILDER routing(String socket, HttpRouting.Builder routing)
      Add Http routing for an additional socket.
      Parameters:
      socket - name of the socket
      routing - HTTP Routing for the given socket name
      Returns:
      updated builder instance
    • config

      @Deprecated public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig>
      Overrides:
      config in class ListenerConfig.BuilderBase<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig>
      Overrides:
      config in class ListenerConfig.BuilderBase<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • shutdownHook

      public BUILDER shutdownHook(boolean shutdownHook)
      When true the webserver registers a shutdown hook with the JVM Runtime.

      Defaults to true. Set this to false such that a shutdown hook is not registered.

      Parameters:
      shutdownHook - whether to register a shutdown hook
      Returns:
      updated builder instance
      See Also:
    • sockets

      public BUILDER sockets(Map<String,? extends ListenerConfig> sockets)
      Socket configurations. Note that socket named "@default" cannot be used, configure the values on the server directly. This method replaces all values with the new ones.
      Parameters:
      sockets - map of listener configurations, except for the default one
      Returns:
      updated builder instance
      See Also:
    • addSockets

      public BUILDER addSockets(Map<String,? extends ListenerConfig> sockets)
      Socket configurations. Note that socket named "@default" cannot be used, configure the values on the server directly. This method keeps existing values, then puts all new values into the map.
      Parameters:
      sockets - map of listener configurations, except for the default one
      Returns:
      updated builder instance
      See Also:
    • putSocket

      public BUILDER putSocket(String key, ListenerConfig socket)
      Socket configurations. Note that socket named "@default" cannot be used, configure the values on the server directly. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      socket - new value for the key
      Returns:
      updated builder instance
      See Also:
    • putSocket

      public BUILDER putSocket(String key, Consumer<ListenerConfig.Builder> consumer)
      Socket configurations. Note that socket named "@default" cannot be used, configure the values on the server directly. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      consumer - consumer of builder for new value
      Returns:
      updated builder instance
      See Also:
    • clearFeatures

      public BUILDER clearFeatures()
      Clear all features.
      Returns:
      updated builder instance
      See Also:
    • features

      public BUILDER features(List<? extends ServerFeature> features)
      Server features allow customization of the server, listeners, or routings.
      Parameters:
      features - server features
      Returns:
      updated builder instance
      See Also:
    • addFeatures

      public BUILDER addFeatures(List<? extends ServerFeature> features)
      Server features allow customization of the server, listeners, or routings.
      Parameters:
      features - server features
      Returns:
      updated builder instance
      See Also:
    • addFeature

      public BUILDER addFeature(ServerFeature feature)
      Server features allow customization of the server, listeners, or routings.
      Parameters:
      feature - add single server features
      Returns:
      updated builder instance
      See Also:
    • clearServerContext

      public BUILDER clearServerContext()
      Clear existing value of serverContext.
      Returns:
      updated builder instance
      See Also:
    • serverContext

      public BUILDER serverContext(Context serverContext)
      Context for the WebServer, if none defined, a new one will be created with global context as the root.
      Parameters:
      serverContext - server context
      Returns:
      updated builder instance
      See Also:
    • serverContext

      public BUILDER serverContext(Consumer<Context.Builder> consumer)
      Context for the WebServer, if none defined, a new one will be created with global context as the root.
      Parameters:
      consumer - consumer of builder of server context
      Returns:
      updated builder instance
      See Also:
    • serverContext

      public BUILDER serverContext(Supplier<? extends Context> supplier)
      Context for the WebServer, if none defined, a new one will be created with global context as the root.
      Parameters:
      supplier - supplier of server context
      Returns:
      updated builder instance
      See Also:
    • featuresDiscoverServices

      public BUILDER featuresDiscoverServices(boolean featuresDiscoverServices)
      Service discovery flag for features(). If set to true, services will be discovered from Java service loader, or Helidon ServiceRegistry.
      Parameters:
      featuresDiscoverServices - whether to enable automatic service discovery
      Returns:
      updated builder instance
      See Also:
    • serviceRegistry

      public BUILDER serviceRegistry(ServiceRegistry serviceRegistry)
      Service registry used to discover providers and services. Provide an explicit registry instance to use.

      If not configured, the GlobalServiceRegistry would be used to discover services.

      Parameters:
      serviceRegistry - service registry to use
      Returns:
      updated builder instance
      See Also:
    • shutdownHook

      public boolean shutdownHook()
      When true the webserver registers a shutdown hook with the JVM Runtime.

      Defaults to true. Set this to false such that a shutdown hook is not registered.

      Returns:
      whether to register a shutdown hook
    • sockets

      public Map<String,ListenerConfig> sockets()
      Socket configurations. Note that socket named "@default" cannot be used, configure the values on the server directly.
      Returns:
      map of listener configurations, except for the default one
    • features

      public List<ServerFeature> features()
      Server features allow customization of the server, listeners, or routings.
      Returns:
      server features
    • serverContext

      public Optional<Context> serverContext()
      Context for the WebServer, if none defined, a new one will be created with global context as the root.
      Returns:
      server context
    • featuresDiscoverServices

      public boolean featuresDiscoverServices()
      Service discovery flag for features(). If set to true, services will be discovered from Java service loader, or Helidon ServiceRegistry.
      Returns:
      whether to enable automatic service discovery
    • serviceRegistry

      public Optional<ServiceRegistry> serviceRegistry()
      Service registry used to discover providers and services. Provide an explicit registry instance to use.

      If not configured, the GlobalServiceRegistry would be used to discover services.

      Returns:
      service registry to use
    • toString

      public String toString()
      Overrides:
      toString in class ListenerConfig.BuilderBase<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig>
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
      Overrides:
      preBuildPrototype in class ListenerConfig.BuilderBase<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig>
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
      Overrides:
      validatePrototype in class ListenerConfig.BuilderBase<BUILDER extends WebServerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends WebServerConfig>