Interface WebServer
-
@Contract @ConstrainedTo(SERVER) public interface WebServer
Jersey service contract for self-contained servers.Runs a self-contained
Applicationin aContainerusing a Web Server implicitly started and stopped together with the application.- Since:
- 3.1.0
- Author:
- Markus KARG (markus@headcrashing.eu)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Containercontainer()intport()CompletionStage<?>start()Initiates server bootstrap.CompletionStage<?>stop()Initiates server shutdown.<T> Tunwrap(Class<T> nativeClass)Provides access to the native handle(s) of the server, if it holds at least one.
-
-
-
Method Detail
-
container
Container container()
- Returns:
- container in which the application lives.
-
port
int port()
- Returns:
- IP port the application listens to for requests.
-
start
CompletionStage<?> start()
Initiates server bootstrap.Startup happens in background. The completion stage produces a native startup result.
Portable applications should not expect any particular result type, as it is implementation-specific.
- Returns:
- A
CompletionStageproviding a native startup result of the bootstrap process. The native result MAY benull.
-
stop
CompletionStage<?> stop()
Initiates server shutdown.Shutdown happens in background. The completion stage produces a native shutdown result.
Portable applications should not expect any particular result type, as it is implementation-specific.- Returns:
- A
CompletionStageproviding a native shutdown result of the shutdown process. The native result MAY benull.
-
unwrap
<T> T unwrap(Class<T> nativeClass)
Provides access to the native handle(s) of the server, if it holds at least one.Implementations MAY use native handles to identify the server instance, and / or use those to communicate with and control the instance. Whether or not such handles exist, and their respective data types, is implementation-specific.
Portable applications should not invoke this method, as the types of supported handles are implementation-specific.
- Parameters:
nativeClass- The class of the native handle.- Returns:
- The native handle, or
nullif no handle of this type exists.
-
-