Class JaxRsCdiExtension

java.lang.Object
io.helidon.microprofile.server.JaxRsCdiExtension
All Implemented Interfaces:
Extension

public class JaxRsCdiExtension extends Object implements Extension
Configure Jersey related things.
  • Constructor Details

    • JaxRsCdiExtension

      public JaxRsCdiExtension()
  • Method Details

    • applicationsToRun

      public List<JaxRsApplication> applicationsToRun() throws IllegalStateException
      List of applications including discovered and explicitly configured applications.

      This method should only be called in Initialized(ApplicationScoped.class) observer methods, that have a higher priority than ServerCdiExtension start server method.

      Returns:
      list of applications found by CDI
      Throws:
      IllegalStateException - in case the list of applications is not yet fixed
    • removeApplications

      public void removeApplications() throws IllegalStateException
      Remove all discovered applications (configured applications are not removed).
      Throws:
      IllegalStateException - in case applications are already started
    • removeResourceClasses

      public void removeResourceClasses() throws IllegalStateException
      Remove all discovered and configured resource classes.
      Throws:
      IllegalStateException - in case applications are already started
    • addResourceClasses

      public void addResourceClasses(List<Class<?>> resourceClasses) throws IllegalStateException
      Add all resource classes from the list to the list of resource classes discovered through CDI. These may be added to an existing application, or may create a synthetic application, depending on other configuration.
      Parameters:
      resourceClasses - resource classes to add
      Throws:
      IllegalStateException - in case applications are already started
    • addApplications

      public void addApplications(List<JaxRsApplication> applications) throws IllegalStateException
      Add all application metadata from the provided list.
      Parameters:
      applications - application metadata
      Throws:
      IllegalStateException - in case applications are already started
      See Also:
    • addApplication

      public void addApplication(Application application) throws IllegalStateException
      Add a jersey application to the server. Context will be introspected from ApplicationPath annotation. You can also use addApplication(String, Application).
      Parameters:
      application - configured as needed
      Throws:
      IllegalStateException - in case applications are already started
    • addApplication

      public void addApplication(String contextRoot, Application application) throws IllegalStateException
      Add a jersey application to the server with an explicit context path.
      Parameters:
      contextRoot - Context root to use for this application (ApplicationPath is ignored)
      application - configured as needed
      Throws:
      IllegalStateException - in case applications are already started
    • serviceName

      public String serviceName()
      Makes an attempt to "guess" the service name.

      Service name is determined as follows:

      • A configuration key service.name
      • A configuration key tracing.service
      • Name of the first JAX-RS application, if any
      • helidon-mp
      Returns:
      name of this service
    • addSyntheticApplication

      public void addSyntheticApplication(List<Class<?>> resourceClasses) throws IllegalStateException
      Create an application from the provided resource classes and add it to the list of applications.
      Parameters:
      resourceClasses - resource classes to create a synthetic application from
      Throws:
      IllegalStateException - in case applications are already started