Interface WebServer


@Contract @ConstrainedTo(SERVER) public interface WebServer
Jersey service contract for self-contained servers.

Runs a self-contained Application in a Container using a Web Server implicitly started and stopped together with the application.

The WebServer instance is wrapped by the implementation of SeBootstrap.Instance.

Since:
3.1.0
Author:
Markus KARG (markus@headcrashing.eu)
  • Method Summary

    Modifier and Type
    Method
    Description
     
    int
     
    Initiates server bootstrap.
    Initiates server shutdown.
    <T> T
    unwrap(Class<T> nativeClass)
    Provides access to the native handle(s) of the server, if it holds at least one.
  • Method Details

    • 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 CompletionStage providing a native startup result of the bootstrap process. The native result MAY be null.
    • 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 CompletionStage providing a native shutdown result of the shutdown process. The native result MAY be null.
    • 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 null if no handle of this type exists.