Class CorsFeature

java.lang.Object
io.helidon.webserver.cors.CorsFeature
All Implemented Interfaces:
RuntimeType.Api<CorsConfig>, NamedService, Weighted, ServerFeature, Comparable<Weighted>

public class CorsFeature extends Object implements Weighted, ServerFeature, RuntimeType.Api<CorsConfig>
Adds CORS support to Helidon WebServer.
  • Field Details

    • WEIGHT

      public static final double WEIGHT
      Default weight of the feature.
      See Also:
  • Method Details

    • builder

      public static CorsConfig.Builder builder()
      Fluent API builder to set up an instance.
      Returns:
      a new builder
    • create

      public static CorsFeature create(CorsConfig config)
      Create a new instance from its configuration.
      Parameters:
      config - configuration
      Returns:
      a new feature
    • create

      public static CorsFeature create(Consumer<CorsConfig.Builder> builderConsumer)
      Create a new instance customizing its configuration.
      Parameters:
      builderConsumer - consumer of configuration
      Returns:
      a new feature
    • create

      public static CorsFeature create()
      Create a new CORS feature with default setup.
      Returns:
      a new feature
    • create

      public static CorsFeature create(Config config)
      Create a new CORS feature with custom setup.
      Parameters:
      config - configuration
      Returns:
      a new configured feature
    • setup

      public void setup(ServerFeature.ServerFeatureContext featureContext)
      Description copied from interface: ServerFeature
      Set up a server feature. Server features can modify server configuration, right before the server is created. To access listener configuration, or routing, a list of all listeners is provided.
      Specified by:
      setup in interface ServerFeature
      Parameters:
      featureContext - to access builders of webserver, listeners, and routing
    • name

      public String name()
      Description copied from interface: NamedService
      Name of this implementation, as provided in ConfiguredProvider.create(Config, String).
      Specified by:
      name in interface NamedService
      Returns:
      name of this service
    • type

      public String type()
      Description copied from interface: NamedService
      Type of this implementation, to distinguish instances of same type, with different NamedService.name(). Use for example ConfiguredProvider.configKey() to define the type.
      Specified by:
      type in interface NamedService
      Returns:
      type of this service
    • prototype

      public CorsConfig prototype()
      Description copied from interface: RuntimeType.Api
      The prototype as it was received when creating this runtime object instance.
      Specified by:
      prototype in interface RuntimeType.Api<CorsConfig>
      Returns:
      prototype object used to create this instance
    • weight

      public double weight()
      Description copied from interface: Weighted
      Weight of this class (maybe because it is defined dynamically, so it cannot be defined by an annotation). If not dynamic, you can use the Weight annotation rather than implementing this interface as long as it is supported by the library using this Weighted.
      Specified by:
      weight in interface Weighted
      Returns:
      the weight of this service, must be a non-negative number