Class HelidonRestServiceSupport

java.lang.Object
io.helidon.servicecommon.rest.HelidonRestServiceSupport
All Implemented Interfaces:
RestServiceSupport, Service
Direct Known Subclasses:
HealthSupport, MetricsSupport, MicrometerSupport, MinimalMetricsSupport

public abstract class HelidonRestServiceSupport extends Object implements RestServiceSupport
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 postConfigureEndpoint(Routing.Rules, Routing.Rules) to do any service-specific routing. See also the HelidonRestServiceSupport.Builder information for possible additional overrides.

  • Constructor Details

    • HelidonRestServiceSupport

      protected HelidonRestServiceSupport(Logger logger, HelidonRestServiceSupport.Builder<?,?> builder, String serviceName)
      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
    • HelidonRestServiceSupport

      protected HelidonRestServiceSupport(Logger logger, RestServiceSettings restServiceSettings, String serviceName)
  • Method Details

    • configureEndpoint

      @Deprecated public final void configureEndpoint(Routing.Rules rules)
      Deprecated.
      Avoid using this obsolete method. Use configureEndpoint(Routing.Rules, Routing.Rules) instead. (Neither method should typically invoked directly from user code.)
      Parameters:
      rules - routing rules (also accepts Routing.Builder
    • configureEndpoint

      public final void configureEndpoint(Routing.Rules defaultRules, Routing.Rules serviceEndpointRoutingRules)
      Configures service endpoint on the provided routing rules. This method just adds the endpoint path (as defaulted or configured). This method is exclusive to Service.update(io.helidon.webserver.Routing.Rules) (e.g. you should not use both, as otherwise you would register the endpoint twice)
      Specified by:
      configureEndpoint in interface RestServiceSupport
      Parameters:
      defaultRules - default routing rules (also accepts Routing.Builder
      serviceEndpointRoutingRules - actual rules (if different from default) for the service endpoint
    • postConfigureEndpoint

      protected abstract void postConfigureEndpoint(Routing.Rules defaultRules, Routing.Rules serviceEndpointRoutingRules)
      Concrete implementations override this method to perform any service-specific routing set-up.
      Parameters:
      defaultRules - default Routing.Rules to be updated
      serviceEndpointRoutingRules - actual rules (if different from the default ones) to be updated for the service endpoint
    • onShutdown

      protected void onShutdown()
    • context

      protected String context()
    • logger

      protected Logger logger()