Class RunConfigurationWebServer

java.lang.Object
com.iizix.jetty.RunConfigurationWebServer
All Implemented Interfaces:
IWebServerCompression, IWebServerDirectoryMapper

public class RunConfigurationWebServer extends Object implements IWebServerCompression, IWebServerDirectoryMapper
Web server that is used when Run Configuration is used, an optimized Jetty Server for "raw Jetty" web socket communication that is used to run one IIZI Module Project (that may refer to others, including Java projects).
Author:
Christopher Mindus
  • Field Details

    • server

      public Server server
      The Jetty Server instance.
  • Constructor Details

  • Method Details

    • getPortConfigurations

      public PortConfig[] getPortConfigurations()
      Returns all the port configurations used for each request.

      Please note that this call will return null if the server never has been not started.

      Returns:
      All the port configurations used by the server, or null if the server never has been started.
    • getWebServerMapping

      public File getWebServerMapping(String mappedFile)
      Gets the map of web server mappings for files.
      Parameters:
      mappedFile - The file to map.
      Returns:
      The mapping from String (such as "dojo.root" or "iiziRunDevel.root") to File Returns null if not found.
    • getWebServerDirectoryAlias

      public File getWebServerDirectoryAlias(String alias)
      Gets the alias directory file for the web server.
      Parameters:
      alias - The alias.
      Returns:
      The file that is aliased to the directory. Returns null if not found.
    • startWebServer

      public PortConfig[] startWebServer(IExternalBrowserPages extPages, WebSocketAcceptor acceptor, IServerSettings settings, Callable<Void> redirCallback, ICommonServletInterface... servlets) throws IOException
      Starts the web server.
      Parameters:
      extPages - External pages implementor, null for none.
      acceptor - The acceptor for engine requests.
      settings - The settings.
      redirCallback - Callback when redirections are ready.
      servlets - Servlets interface(s).
      Returns:
      The port configuration array.
      Throws:
      IOException - For errors.
    • stopWebServer

      public boolean stopWebServer(long maxTime)
      Stops the web server.
      Parameters:
      maxTime - Max time to wait for server to stop, <=0 is forever.
      Returns:
      true for success, false for timeout.
    • addFileRedirection

      public void addFileRedirection(String name, File file)
      Puts a compressed file name into the resource cache of the web server.
      Specified by:
      addFileRedirection in interface IWebServerCompression
      Parameters:
      name - The file name, typically "iizi*-build.css" or "iizi*-build.js".
      file - The compressed CSS or JS file.
    • addFileRedirection

      public void addFileRedirection(File originalFile, File compressedfile)
      Puts a compressed file name into the resource cache of the web server.
      Specified by:
      addFileRedirection in interface IWebServerCompression
      Parameters:
      originalFile - The original uncompressed file.
      compressedfile - The compressed CSS or JS file.
    • addDirectoryMapping

      public File addDirectoryMapping(String mappedFile, File directory) throws FileNotFoundException, IOException
      Adds a directory mapping for the web server to a directory.
      Specified by:
      addDirectoryMapping in interface IWebServerDirectoryMapper
      Parameters:
      directory - The directory to map.
      leadingPath - The leading path from the web root directory to the directory being remapped.
      Returns:
      A previous mapping, or null if none is found.
      Throws:
      FileNotFoundException - If the directory does not exist.
      IOException - If the directory cannot be resolved to a canonical file.
    • getStatistics

      public KString getStatistics()
      Gets the web server statistics as a plain HTML text string.
      Returns:
      The web server statistics formatted as Statistics:\n - item: _item1\n - item2: _item2..., i.e. no body, no div's. If web server is not started, \n\n*** Web server is not started *** is returned. A warning message may be displayed in the server log in case of statistics generation failures.