Class HelidonFeatureSupport

java.lang.Object
io.helidon.webserver.servicecommon.HelidonFeatureSupport
All Implemented Interfaces:
HttpFeature, ServerLifecycle, FeatureSupport, Supplier<HttpFeature>
Direct Known Subclasses:
MicrometerFeature, PrometheusSupport

@Deprecated(forRemoval=true, since="4.4.0") public abstract class HelidonFeatureSupport extends Object implements FeatureSupport
Deprecated, for removal: This API element is subject to removal in a future version.
feature specific CORS configuration is deprecated and will be removed; use either config based CORS setup (configuration key cors, or programmatic setup using the io.helidon.webserver.cors.CorsFeature server feature; reason for existence of this class was CORS configuration - as this is now not needed, this class will most likely be removed in a future version of Helidon; implement an HttpFeature directly instead
Common base implementation for service support classes which involve REST endpoints.

This base class takes care of some tasks common to many services, using config and other settings in the builder:

  • Setting up the endpoint path (web context) for the service, using settings in the builder and config.
  • Providing automatic CORS support (and the ability to control it via config).

Concrete implementations must implement postSetup(HttpRouting.Builder, HttpRouting.Builder) to do any service-specific routing. See also the HelidonFeatureSupport.Builder information for possible additional overrides.

  • Constructor Details

    • HelidonFeatureSupport

      protected HelidonFeatureSupport(System.Logger logger, HelidonFeatureSupport.Builder<?,?> builder, String serviceName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Shared initialization for new service support instances.
      Parameters:
      logger - the Logger for the concrete service support instance
      builder - builder for the service support instance.
      serviceName - name of the service
    • HelidonFeatureSupport

      protected HelidonFeatureSupport(System.Logger logger, RestServiceSettings restServiceSettings, String serviceName)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • setup

      public final void setup(HttpRouting.Builder defaultRouting, HttpRouting.Builder featureRouting)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configures service endpoint on the provided routing rules. This method just adds the endpoint path (as defaulted or configured). This method is exclusive to FeatureSupport.setup(io.helidon.webserver.http.HttpRouting.Builder) (e.g. you should not use both, as otherwise you would register the endpoint twice)
      Specified by:
      setup in interface FeatureSupport
      Parameters:
      defaultRouting - default routing rules (also accepts HttpRouting.Builder
      featureRouting - actual rules (if different from default) for the service endpoint
    • context

      public String context()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: FeatureSupport
      Web context of this service.
      Specified by:
      context in interface FeatureSupport
      Returns:
      context path to be registered
    • configuredContext

      public String configuredContext()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: FeatureSupport
      Web context of this service as configured (may not contain leading slash).
      Specified by:
      configuredContext in interface FeatureSupport
      Returns:
      context path exactly as configured
    • enabled

      public boolean enabled()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: FeatureSupport
      When a service is not enabled, it can be omitted from registration with server.
      Specified by:
      enabled in interface FeatureSupport
      Returns:
      true for enabled services
    • context

      protected void context(String context)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • postSetup

      protected void postSetup(HttpRouting.Builder defaultRouting, HttpRouting.Builder featureRouting)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This can be used to register services, filters etc. on either the default rules (usually the main routing of the web server) and the feature routing (may be the same instance). If FeatureSupport.service() provides an instance, that instance will be correctly registered with the context root on feature routing.
      Parameters:
      defaultRouting - default HttpRules to be updated
      featureRouting - actual rules (if different from the default ones) to be updated for the service endpoint
    • logger

      protected System.Logger logger()
      Deprecated, for removal: This API element is subject to removal in a future version.