Interface HttpFeature

All Superinterfaces:
ServerLifecycle, Supplier<HttpFeature>
All Known Subinterfaces:
FeatureSupport
All Known Implementing Classes:
AccessLogRoutingFeature, DisabledObserverFeature, HelidonFeatureSupport, MicrometerFeature, OidcFeature, PrometheusSupport, SecurityHttpFeature

public interface HttpFeature extends Supplier<HttpFeature>, ServerLifecycle
Can be registered with HttpRouting.Builder.addFeature(java.util.function.Supplier). Encapsulates a set of endpoints, services and/or filters.

Feature is similar to HttpService but gives more freedom in setup. Main difference is that a feature can add Filters and it cannot be registered on a path (that is left to the discretion of the feature developer).

Features are not registered immediately - each feature can define a Weight or implement Weighted to order features according to their weight. Higher weighted features are registered first. This is to allow ordering of features in a meaningful way (e.g. Context should be first, Tracing second, Security third etc.).

  • Method Summary

    Modifier and Type
    Method
    Description
    default HttpFeature
    get()
     
    void
    Method to set up a feature.
    default String
    Name of the listener socket this feature should be registered on, for automatically discovered features.
    default boolean
    Whether the socket defined in socket() must be present for this feature, or it can be exposed on default socket.

    Methods inherited from interface io.helidon.webserver.ServerLifecycle

    afterStop, beforeStart
  • Method Details

    • get

      default HttpFeature get()
      Specified by:
      get in interface Supplier<HttpFeature>
    • setup

      void setup(HttpRouting.Builder routing)
      Method to set up a feature.
      Parameters:
      routing - routing builder
    • socket

      default String socket()
      Name of the listener socket this feature should be registered on, for automatically discovered features.
      Returns:
      name of the listener this service should be bound to
    • socketRequired

      default boolean socketRequired()
      Whether the socket defined in socket() must be present for this feature, or it can be exposed on default socket.
      Returns:
      true if this feature must be exposed on the named socket, false by default