Package io.helidon.microprofile.server
Class JaxRsCdiExtension
- java.lang.Object
-
- io.helidon.microprofile.server.JaxRsCdiExtension
-
-
Constructor Summary
Constructors Constructor Description JaxRsCdiExtension()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addApplication(String contextRoot, Application application)
Add a jersey application to the server with an explicit context path.void
addApplication(Application application)
Add a jersey application to the server.void
addApplications(List<JaxRsApplication> applications)
Add all application metadata from the provided list.void
addResourceClasses(List<Class<?>> resourceClasses)
Add all resource classes from the list to the list of resource classes discovered through CDI.void
addSyntheticApplication(List<Class<?>> resourceClasses)
Create an application from the provided resource classes and add it to the list of applications.List<JaxRsApplication>
applicationsToRun()
List of applications including discovered and explicitly configured applications.void
removeApplications()
Remove all discovered applications (configured applications are not removed).void
removeResourceClasses()
Remove all discovered and configured resource classes.String
serviceName()
Makes an attempt to "guess" the service name.
-
-
-
Method Detail
-
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 thanServerCdiExtension
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:
JaxRsApplication
-
addApplication
public void addApplication(Application application) throws IllegalStateException
Add a jersey application to the server. Context will be introspected fromApplicationPath
annotation. You can also useaddApplication(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
- A configuration key
-
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
-
-