Interface IServer

    • Method Detail

      • addDisposeListener

        boolean addDisposeListener​(IServerDisposeListener listener)
        Adds a server dispose. Calling this method multiple times with the same listener will have no effect (but to return false).
        Parameters:
        listener - The listener to add.
        Returns:
        true if the listener was added, false otherwise.
        Throws:
        java.lang.NullPointerException - If the listener is null.
      • removeDisposeListener

        boolean removeDisposeListener​(IServerDisposeListener listener)
        Removes a server dispose listener.
        Parameters:
        listener - The listener to remove.
        Returns:
        true if listener is successfully removed, false otherwise.
      • startServer

        void startServer()
                  throws java.lang.Throwable
        Starts the server synchronously.
        Throws:
        java.lang.Throwable - for start-up errors.
      • onStartServer

        void onStartServer()
                    throws java.lang.Throwable
        Processes server start-up asynchronously.
        Throws:
        java.lang.Throwable - for start-up errors.
      • loadApplications

        void loadApplications()
                       throws java.lang.Throwable
        Called to load the application.
        Throws:
        java.lang.Throwable - for start-up errors.
      • dispose

        boolean dispose()
        Disposes of the server, e.g. at shut-down. This dispose call will wait until the server has shut-down successfully.
        Returns:
        true for success, false if already disposed of or stopping/disposing.
      • getState

        IServer.State getState()
        Gets the state of the server.
        Returns:
        The server state: STARTING, STARTED, STOPPING or STOPPED.
      • getServerProperties

        ServerProps getServerProperties()
        Gets the Server Properties.
      • addModule

        boolean addModule​(IServerModule<?> module)
        Adds a server module for processing. The module can have an end point constructor that is added during initialization.
        Parameters:
        module - The server module.
        Returns:
        true for success, false if already added.
      • removeModule

        boolean removeModule​(IServerModule<?> module)
        Removes a server module for processing. This will unregister a potential end point constructor and dispose of the module.
        Parameters:
        module - The server module.
        Returns:
        true for success, false if already removed.
      • getEndPointsInstances

        IEndPoint[] getEndPointsInstances()
        Gets an array of all end points. Avoid this method as it causes unnecessary garbage collection, use getEndPointsCollection instead.
        Returns:
        an array of EndPoint instances.
      • onEndPointDisposed

        void onEndPointDisposed​(IEndPoint endPoint)
        Called when an end point is disposed of.
      • addEndPointListener

        IEndPoint[] addEndPointListener​(IEndPointListener listener)
        Adds a listener of end point create/dispose and retrieves the list of current end points. Calling this method several times with the same listener does not add a new one, it is similar to calling getEndPointInstances().
        Parameters:
        listener - The end point listener.
        Returns:
        An array of EndPoint instances.
      • removeEndPointListener

        boolean removeEndPointListener​(IEndPointListener listener)
        Adds a listener of end point create/dispose and retrieves the list of current end points. Calling this method several times with the same listener does not add a new one, it is similar to calling getEndPointInstances().
        Parameters:
        listener - The end point listener.
        Returns:
        true for success, false if not added as listener.
      • getTXPCoordinator

        ITXPCoordinator getTXPCoordinator()
        The transaction processor coordinator.
      • getRootDirectory

        java.lang.String getRootDirectory()
        Gets the web server root directory.
        Returns:
        The directory, or null if web server is not started.
      • registerRequestPrinter

        boolean registerRequestPrinter​(java.lang.String target,
                                       IWebServerRequestPrinter processor)
        Registers a new request printer.
        Parameters:
        target - The target URL, always starting with "/" and doesn't contain the query.
        processor - The print processor.
        Returns:
        true if added successfully, false if the print processor already exists or the server is not started yet.
      • unregisterRequestPrinter

        boolean unregisterRequestPrinter​(java.lang.String target,
                                         IWebServerRequestPrinter processor)
        Unregister a previously registered request printer.
        Parameters:
        target - The target URL, always starting with "/" and doesn't contain the query.
        processor - The print processor.
        Returns:
        true if removed successfully, false if the print processor does not exist or doesn't match, or the server is not yet started.