Package io.helidon.microprofile.server
Class ServerCdiExtension
java.lang.Object
io.helidon.microprofile.server.ServerCdiExtension
- All Implemented Interfaces:
Extension
Extension to handle web server configuration and lifecycle.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFeature
(ServerFeature feature) Add a server feature.void
addObserver
(Observer observer) Add an observer, probably from an observer specific CDI extension.void
addRouting
(Builder<?, ? extends Routing> routing) Add a routing to the server.void
addRouting
(Builder<?, ? extends Routing> routing, String socketName, boolean required, String appName) Add a routing to the server.void
Base path of this server.host()
Current host the server is running on.int
port()
Current port the server is running on.int
Named port the server is running on.Helidon webserver routing builder that can be used to add routes to a named socket of the webserver.Helidon webserver routing builder that can be used to add routes to the webserver.boolean
started()
State of the server.
-
Constructor Details
-
ServerCdiExtension
public ServerCdiExtension()Default constructor required byServiceLoader
.
-
-
Method Details
-
serverRoutingBuilder
Helidon webserver routing builder that can be used to add routes to the webserver.- Returns:
- server routing builder
-
serverNamedRoutingBuilder
Helidon webserver routing builder that can be used to add routes to a named socket of the webserver.- Parameters:
name
- name of the named routing (should match a named socket configuration)- Returns:
- builder for routing of the named route
-
addRouting
Add a routing to the server. This MUST NOT be HTTP routing. To update HTTP routing, please useserverRoutingBuilder()
.- Parameters:
routing
- routing to add, such as WebSocket routing
-
addRouting
public void addRouting(Builder<?, ? extends Routing> routing, String socketName, boolean required, String appName) Add a routing to the server. This MUST NOT be HTTP routing. To update HTTP routing, please useserverNamedRoutingBuilder(String)
.- Parameters:
routing
- routing to add, such as WebSocket routingsocketName
- name of the configured socket this routing should be assigned to, if not present (and required is false), the routing would be added to default socketrequired
- is the socket required to be present, validated against configured socketsappName
- name of the application, to provide meaningful error messages
-
addObserver
Add an observer, probably from an observer specific CDI extension. Observers are also discovered using a service loader, so if no customization in CDI is needed, the extension is not needed either.- Parameters:
observer
- observer to add
-
host
Current host the server is running on.- Returns:
- host of this server
-
port
public int port()Current port the server is running on. This information is only available after the server is actually started.- Returns:
- port the server is running on
-
port
Named port the server is running on. This information is only available after the server is actually started.- Parameters:
name
- Socket name- Returns:
- Named port the server is running on
-
started
public boolean started()State of the server.- Returns:
true
if the server is already started,false
otherwise
-
basePath
Base path of this server. This is used to redirect when a request is made for root ("/").- Parameters:
basePath
- path to redirect to when user requests the root path
-
addFeature
Add a server feature.- Parameters:
feature
- feature to add
-