Class CorsEnabledServiceHelper

java.lang.Object
io.helidon.webserver.cors.CorsEnabledServiceHelper

@Deprecated(forRemoval=true, since="4.4.0") public class CorsEnabledServiceHelper extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Helidon is centralizing CORS handling into a single feature, you can configure this feature using config, or set it up through builder and register it with a web server - see CorsFeature; additional protected paths can be specified using CorsConfig.BuilderBase.addPath(CorsPathConfig), or by creating a ServiceRegistry that provides an instance of CorsPathConfig.
Allows services (including Helidon WebServer built-in services) to register CORS support easily.

Callers use either create(String) or create(String, CrossOriginConfig) to initialize the helper for a service. The helper uses the CrossOriginConfig instance to set up CORS behavior for the service. If the caller passes a null CrossOriginConfig or invokes the other variant of create then the sets up CORS using a default configuration:

     enabled: true
     allow-origins: ["*"]
     allow-methods: ["GET", "HEAD", "OPTIONS"]
     allow-headers: ["*"]
     allow-credentials: false
     max-age: 3600
     
All of those settings except for allow-methods are the defaults for CrossOriginConfig.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Deprecated, for removal: This API element is subject to removal in a future version.
    Conventional configuration key for CORS set-up; used for built-in services.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(String serviceName)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new helper based on a default CORS config for services.
    create(String serviceName, CrossOriginConfig crossOriginConfig)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a new helper based on the provided config.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Constructs a Handler for performing CORS processing, according to the previously-provided Config.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CORS_CONFIG_KEY

      public static final String CORS_CONFIG_KEY
      Deprecated, for removal: This API element is subject to removal in a future version.
      Conventional configuration key for CORS set-up; used for built-in services.
      See Also:
  • Method Details

    • create

      public static CorsEnabledServiceHelper create(String serviceName, CrossOriginConfig crossOriginConfig)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new helper based on the provided config.
      Parameters:
      serviceName - name of the service (for logging)
      crossOriginConfig - CrossOriginConfig containing CORS set-up; if null, a default is used
      Returns:
      new helper initialized with the CORS configuration
    • create

      public static CorsEnabledServiceHelper create(String serviceName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a new helper based on a default CORS config for services.
      Parameters:
      serviceName - name of the service (for logging)
      Returns:
      new helper initialized with a default CORS configuration
    • processor

      public Handler processor()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructs a Handler for performing CORS processing, according to the previously-provided Config.
      Returns:
      Handler for CORS processing