Class RequestScopeFeature

java.lang.Object
io.helidon.webserver.RequestScopeFeature
All Implemented Interfaces:
io.helidon.common.config.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<io.helidon.service.registry.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()
      Specified by:
      name in interface io.helidon.common.config.NamedService
    • type

      public String type()
      Specified by:
      type in interface io.helidon.common.config.NamedService