- All Implemented Interfaces:
Builder<Server.Builder,
,Server> Supplier<Server>
- Enclosing interface:
- Server
Server
instance.-
Method Summary
Modifier and TypeMethodDescriptionaddApplication
(JaxRsApplication application) Add a JAX-RS application with all possible options to this server.addApplication
(Application application) JAX-RS application to use.addApplication
(Class<? extends Application> applicationClass) JAX-RS application class to use.addApplication
(String contextRoot, Application application) JAX-RS application to use.addApplication
(String contextRoot, Class<? extends Application> applicationClass) JAX-RS application class to use.addResourceClass
(Class<?> resource) Add a JAX-RS resource class to use.applications
(Application... applications) Replace existing applications with the ones provided.Configure a path to which the server would redirect when a root path is requested.build()
Build a server based on this builder.Configuration instance to use to configure this server (Helidon config).Configuration instance to use to configure this server (Microprofile config).defaultExecutorServiceSupplier
(Supplier<? extends ExecutorService> supplier) Set a supplier of an executor service to use for tasks connected with application processing (JAX-RS).Configure listen host.port
(int port) Configure listen port.resourceConfig
(ResourceConfig config) JAX-RS resource configuration to use.retainDiscoveredApplications
(boolean retain) If any application or resource class is added through this builder, applications discovered by CDI are ignored.
-
Method Details
-
build
Build a server based on this builder.- Specified by:
build
in interfaceBuilder<Server.Builder,
Server> - Returns:
- Server instance to be started
- Throws:
MpException
- in case the server fails to be created
-
host
Configure listen host.- Parameters:
host
- hostname- Returns:
- modified builder
-
basePath
Configure a path to which the server would redirect when a root path is requested. E.g. when static content is available at "/static" and you want to start there on index.html, you may want to configure this to "/static/index.html". When user requests "http://host:port" or "http://host:port/", the user would be redirected to "http://host:port/static/index.html"- Parameters:
basePath
- path to redirect user from root path- Returns:
- updated builder instance
-
defaultExecutorServiceSupplier
Set a supplier of an executor service to use for tasks connected with application processing (JAX-RS).- Parameters:
supplier
- executor service supplier, only called when an application is configured without its own executor service- Returns:
- updated builder instance
-
port
Configure listen port.- Parameters:
port
- port- Returns:
- modified builder
-
config
Configuration instance to use to configure this server (Helidon config).- Parameters:
config
- configuration to use- Returns:
- modified builder
-
config
Configuration instance to use to configure this server (Microprofile config).- Parameters:
config
- configuration to use- Returns:
- modified builder
-
resourceConfig
JAX-RS resource configuration to use. This will add the provided resource config as an additional application.- Parameters:
config
- configuration to bootstrap Jersey- Returns:
- modified builder
-
addApplication
Add a JAX-RS application with all possible options to this server.- Parameters:
application
- application to add- Returns:
- updated builder instance
-
addApplication
JAX-RS application to use. If more than one application is added, they must be registered on differentApplicationPath
. Also you must make sure that paths do not overlap, as that may cause unexpected results (e.g. registering one application under root ("/") and another under "/app1" would not work as expected).Order is (e.g. if application is defined, resource classes are ignored):
- All Applications and Application classes
- Resource classes
- Resource config
- Parameters:
application
- application to bootstrap Jersey- Returns:
- modified builder
-
retainDiscoveredApplications
If any application or resource class is added through this builder, applications discovered by CDI are ignored. You can change this behavior by setting the retain discovered applications totrue
.If you use
Server.Builder
and explicitly add a JAX-RS application or JAX-RS resource class to it, then classes discovered via CDI mechanisms will be ignored (e.g. all JAX-RS applications with bean defining annotations and all JAX-RS resources in bean archives). If you set the flag to true, we will retain both the "discovered" and "explicitly configured" applications and resource classes.- Parameters:
retain
- whether to keep applications discovered by CDI even if any are explicitly added- Returns:
- updated builder instance
-
applications
Replace existing applications with the ones provided.- Parameters:
applications
- new applications to use with this server builder- Returns:
- updated builder instance
-
addApplication
JAX-RS application to use. If more than one application is added, they must be registered on differentApplicationPath
. Also you must make sure that paths do not overlap, as that may cause unexpected results (e.g. registering one application under root ("/") and another under "/app1" would not work as expected).Order is (e.g. if application is defined, resource classes are ignored):
- All Applications and Application classes
- Resource classes
- Resource config
- Parameters:
contextRoot
- context root this application will be available underapplication
- application to bootstrap Jersey- Returns:
- modified builder
-
addApplication
JAX-RS application class to use.Order is (e.g. if application is defined, resource classes are ignored):
- Application class
- Application
- Resource classes
- Resource config
- Parameters:
applicationClass
- application class to bootstrap Jersey- Returns:
- modified builder
-
addApplication
public Server.Builder addApplication(String contextRoot, Class<? extends Application> applicationClass) JAX-RS application class to use.Order is (e.g. if application is defined, resource classes are ignored):
- Applications and application classes
- Resource classes
- Resource config
- Parameters:
contextRoot
- context root to serve this application underapplicationClass
- application class to bootstrap Jersey- Returns:
- modified builder
-
addResourceClass
Add a JAX-RS resource class to use.Order is (e.g. if application is defined, resource classes are ignored):
- Applications and application classes
- Resource classes
- Resource config
- Parameters:
resource
- resource class to add, list of these classes is used to bootstrap Jersey- Returns:
- modified builder
-