Class RequestScopeFeature

java.lang.Object
io.helidon.webserver.RequestScopeFeature
All Implemented Interfaces:
NamedService, ServerFeature

public class RequestScopeFeature extends Object implements ServerFeature
A feature that adds request scope support to Helidon declarative.

This feature is not enabled by default, as request scope adds a certain amount of overhead to performance. It should only be enabled when you want injection of request scoped services outside of entry points. In general, we do not recommend such an approach, as it leaks communication protocol details into your business logic. Nevertheless it is supported, as this approach is sometimes used.

  • Method Details

    • create

      public static RequestScopeFeature create(Supplier<Scopes> scopes, boolean enabled)
      Create a request scope feature for Helidon declarative. This feature is not useful when running Helidon imperative.
      Parameters:
      scopes - scopes (injected from service registry) to create the request scope when needed
      enabled - whether this feature should be enabled
      Returns:
      a new request scope feature to be added to the web server
    • 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