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

java.lang.Object
io.helidon.webserver.cors.CorsConfig.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:
CorsConfig.Builder
Enclosing interface:
CorsConfig

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

    • BuilderBase

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

    • from

      public BUILDER from(CorsConfig 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(CorsConfig.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
    • 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 CorsConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends CorsConfig>
      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 CorsConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends CorsConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • weight

      public BUILDER weight(double weight)
      Weight of the CORS feature. As it is used by other features, the default is quite high: 850.0.
      Parameters:
      weight - weight of the feature
      Returns:
      updated builder instance
      See Also:
    • clearSockets

      public BUILDER clearSockets()
      Clear all sockets.
      Returns:
      updated builder instance
      See Also:
    • sockets

      public BUILDER sockets(Set<String> sockets)
      List of sockets to register this feature on. If empty, it would get registered on all sockets.
      Parameters:
      sockets - socket names to register on, defaults to empty (all available sockets)
      Returns:
      updated builder instance
      See Also:
    • addSockets

      public BUILDER addSockets(Set<String> sockets)
      List of sockets to register this feature on. If empty, it would get registered on all sockets.
      Parameters:
      sockets - socket names to register on, defaults to empty (all available sockets)
      Returns:
      updated builder instance
      See Also:
    • addSocket

      public BUILDER addSocket(String socket)
      List of sockets to register this feature on. If empty, it would get registered on all sockets.
      Parameters:
      socket - add single socket names to register on, defaults to empty (all available sockets)
      Returns:
      updated builder instance
      See Also:
    • name

      public BUILDER name(String name)
      Name of this instance.
      Parameters:
      name - instance name
      Returns:
      updated builder instance
      See Also:
    • enabled

      public BUILDER enabled(boolean enabled)
      This feature can be disabled. This feature is automatically enabled if there is at least one paths() defined.
      Parameters:
      enabled - whether the feature is enabled
      Returns:
      updated builder instance
      See Also:
    • clearPaths

      public BUILDER clearPaths()
      Clear all paths.
      Returns:
      updated builder instance
      See Also:
    • paths

      public BUILDER paths(List<? extends CorsPathConfig> paths)
      Per path configuration. Default path is added, unless addDefaults() is set to false.
      Parameters:
      paths - per path configurations
      Returns:
      updated builder instance
      See Also:
    • addPaths

      public BUILDER addPaths(List<? extends CorsPathConfig> paths)
      Per path configuration. Default path is added, unless addDefaults() is set to false.
      Parameters:
      paths - per path configurations
      Returns:
      updated builder instance
      See Also:
    • addPath

      public BUILDER addPath(CorsPathConfig path)
      Per path configuration. Default path is added, unless addDefaults() is set to false.
      Parameters:
      path - add single per path configurations
      Returns:
      updated builder instance
      See Also:
    • addPath

      public BUILDER addPath(Consumer<CorsPathConfig.Builder> consumer)
      Per path configuration. Default path is added, unless addDefaults() is set to false.
      Parameters:
      consumer - consumer of builder for per path configurations
      Returns:
      updated builder instance
      See Also:
    • addDefaults

      public BUILDER addDefaults(boolean addDefaults)
      Whether to add a default path configuration, that matches all paths, GET, HEAD, POST methods, and allows all origins, methods, and headers. This is always added as a last path.
      Parameters:
      addDefaults - whether to add defaults as the last path, defaults to true
      Returns:
      updated builder instance
      See Also:
    • pathsDiscoverServices

      public BUILDER pathsDiscoverServices(boolean pathsDiscoverServices)
      Service discovery flag for paths(). If set to true, services will be discovered from Java service loader, or Helidon ServiceRegistry.
      Parameters:
      pathsDiscoverServices - 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:
    • weight

      public double weight()
      Weight of the CORS feature. As it is used by other features, the default is quite high: 850.0.
      Returns:
      weight of the feature
    • sockets

      public Set<String> sockets()
      List of sockets to register this feature on. If empty, it would get registered on all sockets.
      Returns:
      socket names to register on, defaults to empty (all available sockets)
    • name

      public String name()
      Name of this instance.
      Returns:
      instance name
    • enabled

      public Optional<Boolean> enabled()
      This feature can be disabled. This feature is automatically enabled if there is at least one paths() defined.
      Returns:
      whether the feature is enabled
    • paths

      public List<CorsPathConfig> paths()
      Per path configuration. Default path is added, unless addDefaults() is set to false.
      Returns:
      per path configurations
    • addDefaults

      public boolean addDefaults()
      Whether to add a default path configuration, that matches all paths, GET, HEAD, POST methods, and allows all origins, methods, and headers. This is always added as a last path.
      Returns:
      whether to add defaults as the last path, defaults to true
    • config

      @Deprecated(since="4.4.0", forRemoval=true) public Optional<Config> config()
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method will be removed without a replacement, path based configuration is now handled by paths()
      Access to config that was used to create this feature.
      Returns:
      configuration
    • pathsDiscoverServices

      public boolean pathsDiscoverServices()
      Service discovery flag for paths(). 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 Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.