Class Server


  • public class Server
    extends java.lang.Object
    Implementation of the WebSocket Server.
    Author:
    Stepan Kopriva, Pavel Bucek
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String STATIC_CONTENT_ROOT
      Path to static content to be served by created Server instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      Server​(java.lang.Class<?>... configuration)
      Create new server instance.
      Server​(java.lang.String hostName, int port, java.lang.String contextPath, java.util.Map<java.lang.String,​java.lang.Object> properties, java.lang.Class<?>... configuration)
      Construct new server.
      Server​(java.lang.String hostName, int port, java.lang.String contextPath, java.util.Map<java.lang.String,​java.lang.Object> properties, java.util.Set<java.lang.Class<?>> configuration)
      Construct new server.
      Server​(java.util.Map<java.lang.String,​java.lang.Object> properties, java.lang.Class<?>... configuration)
      Create new server instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getPort()
      Get the port which was used to start the container.
      static void main​(java.lang.String[] args)  
      void start()
      Start the server.
      void stop()
      Stop the server.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Server

        public Server​(java.util.Map<java.lang.String,​java.lang.Object> properties,
                      java.lang.Class<?>... configuration)
        Create new server instance.
        Parameters:
        properties - properties used as a parameter to (java.util.Map) call.
        configuration - to be registered with the server. Classes annotated with ServerEndpoint, implementing ServerApplicationConfig or extending ServerEndpointConfig are supported.
      • Server

        public Server​(java.lang.String hostName,
                      int port,
                      java.lang.String contextPath,
                      java.util.Map<java.lang.String,​java.lang.Object> properties,
                      java.lang.Class<?>... configuration)
        Construct new server.
        Parameters:
        hostName - hostName of the server.
        port - port of the server. When provided value is 0, default port (8025) will be used, when -1, ephemeral port number will be used.
        contextPath - root path to the server App.
        properties - properties used as a parameter to (java.util.Map) call.
        configuration - to be registered with the server. Classes annotated with ServerEndpoint, implementing ServerApplicationConfig or extending ServerEndpointConfig are supported.
        See Also:
        getPort()
      • Server

        public Server​(java.lang.String hostName,
                      int port,
                      java.lang.String contextPath,
                      java.util.Map<java.lang.String,​java.lang.Object> properties,
                      java.util.Set<java.lang.Class<?>> configuration)
        Construct new server.
        Parameters:
        hostName - hostName of the server.
        port - port of the server. When provided value is 0, default port (8025) will be used, when -1, ephemeral port number will be used.
        contextPath - root path to the server App.
        properties - properties used as a parameter to (java.util.Map) call.
        configuration - to be registered with the server. Classes annotated with ServerEndpoint, implementing ServerApplicationConfig or extending ServerEndpointConfig are supported.
        See Also:
        getPort()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
      • getPort

        public int getPort()
        Get the port which was used to start the container.
        Returns:
        the port which was used to start the container.
      • stop

        public void stop()
        Stop the server.