Class HelidonComponentProvider

java.lang.Object
org.glassfish.tyrus.core.ComponentProvider
io.helidon.microprofile.tyrus.HelidonComponentProvider

public class HelidonComponentProvider extends org.glassfish.tyrus.core.ComponentProvider
A service provider for Tyrus to create and destroy beans using CDI. By default, and according to the Jakarta WebSocket specification, beans are created and destroyed for each client connection (in "connection scope"). However, this provider also supports endpoints in ApplicationScoped. These endpoint instances are not destroyed here but at a later time by the CDI container. No other scopes are currently supported.
  • Constructor Details

    • HelidonComponentProvider

      public HelidonComponentProvider()
  • Method Details

    • isApplicable

      public boolean isApplicable(Class<?> c)
      Checks if a bean is known to CDI.
      Specified by:
      isApplicable in class org.glassfish.tyrus.core.ComponentProvider
      Parameters:
      c - Class to be checked
      Returns:
      outcome of test
    • create

      public <T> Object create(Class<T> c)
      Create a new instance using CDI. Note that if the bean is ApplicationScoped the same instance will be returned every time this method is called.
      Specified by:
      create in class org.glassfish.tyrus.core.ComponentProvider
      Type Parameters:
      T - type of new instance
      Parameters:
      c - Class to be created
      Returns:
      new instance
    • destroy

      public boolean destroy(Object o)
      Beans are normally scoped to a client connection. However, if a bean is explicitly set to be in ApplicationScoped, it will not be destroyed here.
      Specified by:
      destroy in class org.glassfish.tyrus.core.ComponentProvider
      Parameters:
      o - instance to be destroyed
      Returns:
      outcome of operation