- 
 public interface WebServerRepresents a immutably configured WEB server.Provides basic lifecycle and monitoring API. Instance can be created from Routingand optionally fromConfigusingcreate(Routing),create(Routing, io.helidon.config.Config)orbuilder(Routing)methods and their builder enabled overloads.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static classWebServer.BuilderWebServer builder class provides a convenient way to set up WebServer with multiple server sockets and optional multiple routings.
 - 
Field SummaryFields Modifier and Type Field Description static StringDEFAULT_SOCKET_NAMEThe default server socket configuration name.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static WebServer.Builderbuilder()Creates a fluent API builder of theWebServer.static WebServer.Builderbuilder(Routing routing)Creates a builder of theWebServer.static WebServer.Builderbuilder(Supplier<? extends Routing> routingBuilder)Creates a builder of theWebServer.ServerConfigurationconfiguration()Gets effective server configuration.Contextcontext()Gets aWebServercontext.static WebServercreate(Routing routing)Creates new instance from provided routing and default configuration.static WebServercreate(Routing routing, Config config)Creates new instance from provided configuration and routing.static WebServercreate(ServerConfiguration configuration, Routing routing)Deprecated.since 2.0.0 - please usecreate(Routing, io.helidon.config.Config)instead for instances based onConfig, orbuilder(Routing)to configure server configuration by hand (as you would onSocketConfiguration.Buildernow.static WebServercreate(ServerConfiguration configuration, Supplier<? extends Routing> routingBuilder)Deprecated.since 2.0.0 - please usecreate(java.util.function.Supplier, io.helidon.config.Config)instead for instances based onConfig, orbuilder(java.util.function.Supplier)to configure server configuration by hand (as you would onSocketConfiguration.Buildernow.static WebServercreate(Supplier<? extends Routing> routingBuilder)Creates new instance from provided routing and default configuration.static WebServercreate(Supplier<? extends ServerConfiguration> configurationBuilder, Routing routing)Deprecated.since 2.0.0 - please usecreate(io.helidon.webserver.Routing, io.helidon.config.Config)instead for instances based onConfig, orbuilder(io.helidon.webserver.Routing)to configure server configuration by hand (as you would onSocketConfiguration.Buildernow.static WebServercreate(Supplier<? extends ServerConfiguration> configurationBuilder, Supplier<? extends Routing> routingBuilder)Deprecated.since 2.0.0 - please usecreate(java.util.function.Supplier, io.helidon.config.Config)instead for instances based onConfig, orbuilder(java.util.function.Supplier)to configure server configuration by hand (as you would onSocketConfiguration.Buildernow.static WebServercreate(Supplier<Routing> routingBuilder, Config config)Creates new instance from provided configuration and routing.default booleanhasTls()Returnstrueif TLS is configured for the default socket.booleanhasTls(String socketName)Returnstrueif TLS is configured for the named socket.booleanisRunning()Returnstrueif the server is currently running.default intport()Returns a port number the default server socket is bound to and is listening on; or-1if unknown or not active.intport(String socketName)Returns a port number an additional named server socket is bound to and is listening on; or-1if unknown or not active.MessageBodyReaderContextreaderContext()Get the parentMessageBodyReaderContextcontext.Single<WebServer>shutdown()Attempt to gracefully shutdown server.Single<WebServer>start()Starts the server.voidupdateTls(WebServerTls tls)Update the TLS configuration of the default socketDEFAULT_SOCKET_NAME.voidupdateTls(WebServerTls tls, String socketName)Update the TLS configuration of the named socket.Single<WebServer>whenShutdown()Completion stage is completed when server is shut down.MessageBodyWriterContextwriterContext()Get the parentMessageBodyWriterContextcontext.
 
- 
- 
- 
Field Detail- 
DEFAULT_SOCKET_NAMEstatic final String DEFAULT_SOCKET_NAME The default server socket configuration name. All the default server socket configuration such asWebServer.Builder.hasSocket(String)orport(String)is accessible using this name.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
configurationServerConfiguration configuration() Gets effective server configuration.- Returns:
- Server configuration
 
 - 
startSingle<WebServer> start() Starts the server. Has no effect if server is running. The start will fail on a server that is shut down, or that failed to start. In such cases, create a new instance of Web Server.- Returns:
- a single to react on startup process
 
 - 
whenShutdownSingle<WebServer> whenShutdown() Completion stage is completed when server is shut down.- Returns:
- a completion stage of the server
 
 - 
shutdownSingle<WebServer> shutdown() Attempt to gracefully shutdown server. It is possible to use returnedSingleto react.RequestMethod can be called periodically. - Returns:
- a single to react on finished shutdown process
- See Also:
- start()
 
 - 
isRunningboolean isRunning() Returnstrueif the server is currently running. Running server in stopping phase returnstrueuntil it is not fully stopped.- Returns:
- trueif server is running
 
 - 
readerContextMessageBodyReaderContext readerContext() Get the parentMessageBodyReaderContextcontext.- Returns:
- media body reader context
 
 - 
writerContextMessageBodyWriterContext writerContext() Get the parentMessageBodyWriterContextcontext.- Returns:
- media body writer context
 
 - 
portdefault int port() Returns a port number the default server socket is bound to and is listening on; or-1if unknown or not active.It is supported only when server is running. - Returns:
- a listen port; or -1if unknown or the default server socket is not active
 
 - 
portint port(String socketName) Returns a port number an additional named server socket is bound to and is listening on; or-1if unknown or not active.- Parameters:
- socketName- the name of an additional named server socket
- Returns:
- a listen port; or -1if socket name is unknown or the server socket is not active
 
 - 
hasTlsdefault boolean hasTls() Returnstrueif TLS is configured for the default socket.- Returns:
- whether TLS is enabled for the default socket
 
 - 
hasTlsboolean hasTls(String socketName) Returnstrueif TLS is configured for the named socket.- Parameters:
- socketName- the name of a socket
- Returns:
- whether TLS is enabled for the socket, returns falseif the socket does not exists
 
 - 
updateTlsvoid updateTls(WebServerTls tls) Update the TLS configuration of the default socketDEFAULT_SOCKET_NAME.- Parameters:
- tls- new TLS configuration
- Throws:
- IllegalStateException- if- WebServerTls.enabled()returns- falseor if- SocketConfiguration.ssl()returns- null
 
 - 
updateTlsvoid updateTls(WebServerTls tls, String socketName) Update the TLS configuration of the named socket.- Parameters:
- tls- new TLS configuration
- socketName- specific named socket name
- Throws:
- IllegalStateException- if- WebServerTls.enabled()returns- falseor if- SocketConfiguration.ssl()returns- null
 
 - 
create@Deprecated static WebServer create(Supplier<? extends ServerConfiguration> configurationBuilder, Routing routing) Deprecated.since 2.0.0 - please usecreate(io.helidon.webserver.Routing, io.helidon.config.Config)instead for instances based onConfig, orbuilder(io.helidon.webserver.Routing)to configure server configuration by hand (as you would onSocketConfiguration.Buildernow.Creates a new instance from a provided configuration and a routing.- Parameters:
- configurationBuilder- a server configuration builder that will be built as a first step of this method execution; may be- null
- routing- a routing instance
- Returns:
- a new web server instance
- Throws:
- IllegalStateException- if none SPI implementation found
- NullPointerException- if 'routing' parameter is- null
 
 - 
create@Deprecated static WebServer create(Supplier<? extends ServerConfiguration> configurationBuilder, Supplier<? extends Routing> routingBuilder) Deprecated.since 2.0.0 - please usecreate(java.util.function.Supplier, io.helidon.config.Config)instead for instances based onConfig, orbuilder(java.util.function.Supplier)to configure server configuration by hand (as you would onSocketConfiguration.Buildernow.Creates new instance from provided configuration and routing.- Parameters:
- configurationBuilder- a server configuration builder that will be built as a first step of this method execution; may be- null
- routingBuilder- a routing builder that will be built as a second step of this method execution
- Returns:
- a new web server instance
- Throws:
- IllegalStateException- if none SPI implementation found
- NullPointerException- if 'routingBuilder' parameter is- null
 
 - 
create@Deprecated static WebServer create(ServerConfiguration configuration, Supplier<? extends Routing> routingBuilder) Deprecated.since 2.0.0 - please usecreate(java.util.function.Supplier, io.helidon.config.Config)instead for instances based onConfig, orbuilder(java.util.function.Supplier)to configure server configuration by hand (as you would onSocketConfiguration.Buildernow.Creates new instance from provided configuration and routing.- Parameters:
- configuration- a server configuration instance
- routingBuilder- a routing builder that will be built as a second step of this method execution
- Returns:
- a new web server instance
- Throws:
- IllegalStateException- if none SPI implementation found
- NullPointerException- if 'routingBuilder' parameter is- null
 
 - 
createstatic WebServer create(Routing routing) Creates new instance from provided routing and default configuration.- Parameters:
- routing- a routing instance
- Returns:
- a new web server instance
- Throws:
- IllegalStateException- if none SPI implementation found
- NullPointerException- if 'routing' parameter is- null
 
 - 
create@Deprecated static WebServer create(ServerConfiguration configuration, Routing routing) Deprecated.since 2.0.0 - please usecreate(Routing, io.helidon.config.Config)instead for instances based onConfig, orbuilder(Routing)to configure server configuration by hand (as you would onSocketConfiguration.Buildernow.Creates new instance from provided configuration and routing.- Parameters:
- configuration- a server configuration instance
- routing- a routing instance
- Returns:
- a new web server instance
- Throws:
- NullPointerException- if 'routing' parameter is- null
 
 - 
createstatic WebServer create(Routing routing, Config config) Creates new instance from provided configuration and routing.- Parameters:
- routing- a routing instance
- config- configuration located on server configuration node
- Returns:
- a new web server instance
- Throws:
- NullPointerException- if 'routing' parameter is- null
- Since:
- 2.0.0
 
 - 
createstatic WebServer create(Supplier<Routing> routingBuilder, Config config) Creates new instance from provided configuration and routing.- Parameters:
- routingBuilder- a supplier of routing (such as- Routing.Builder
- config- configuration located on server configuration node
- Returns:
- a new web server instance
- Throws:
- NullPointerException- if 'routing' parameter is- null
- Since:
- 2.0.0
 
 - 
createstatic WebServer create(Supplier<? extends Routing> routingBuilder) Creates new instance from provided routing and default configuration.- Parameters:
- routingBuilder- a routing builder instance that will be built as a first step of this method execution
- Returns:
- a new web server instance
- Throws:
- IllegalStateException- if none SPI implementation found
- NullPointerException- if 'routing' parameter is- null
 
 - 
builderstatic WebServer.Builder builder(Supplier<? extends Routing> routingBuilder) Creates a builder of theWebServer.- Parameters:
- routingBuilder- the routing builder; must not be- null
- Returns:
- the builder
 
 - 
builderstatic WebServer.Builder builder() Creates a fluent API builder of theWebServer. Before calling theWebServer.Builder.build()method, you should configure the default routing. If none is configured, all requests will end in404.- Returns:
- a new builder
 
 - 
builderstatic WebServer.Builder builder(Routing routing) Creates a builder of theWebServer.- Parameters:
- routing- the routing to use for the default port; must not be- null
- Returns:
- the builder
- See Also:
- builder()
 
 
- 
 
-