Package io.helidon.microprofile.server
Class JaxRsCdiExtension
java.lang.Object
io.helidon.microprofile.server.JaxRsCdiExtension
- All Implemented Interfaces:
Extension
Configure Jersey related things.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addApplication
(Application application) Add a jersey application to the server.void
addApplication
(String contextRoot, Application application) Add a jersey application to the server with an explicit context path.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 of applications including discovered and explicitly configured applications.void
Remove all discovered applications (configured applications are not removed).void
Remove all discovered and configured resource classes.Makes an attempt to "guess" the service name.
-
Constructor Details
-
JaxRsCdiExtension
public JaxRsCdiExtension()Default constructor is required byServiceLoader
.
-
-
Method Details
-
applicationsToRun
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
Remove all discovered applications (configured applications are not removed).- Throws:
IllegalStateException
- in case applications are already started
-
removeResourceClasses
Remove all discovered and configured resource classes.- Throws:
IllegalStateException
- in case applications are already started
-
addResourceClasses
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
Add all application metadata from the provided list.- Parameters:
applications
- application metadata- Throws:
IllegalStateException
- in case applications are already started- See Also:
-
addApplication
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
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
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
-