Class IntegratedWebServer

  • All Implemented Interfaces:
    IWebServerCompression

    public class IntegratedWebServer
    extends java.lang.Object
    implements IWebServerCompression
    The Jetty integrated web server class in iiziGo Designer.
    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      IntegratedWebServer​(java.util.Map<java.lang.String,​java.io.File> redirect, java.lang.String root)
      The constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidaddFileRedirection​(java.io.File originalFile, java.io.File compressedfile)
      Puts a compressed file name into the resource cache of the web server.
      voidaddFileRedirection​(java.lang.String name, java.io.File file)
      Puts a compressed file name into the resource cache of the web server.
      java.lang.StringgetBindAddress()
      Returns the bind address/name.
      java.lang.StringgetExternalServerURL()
      Returns the external server URL.
      intgetSecureWebServerPort()
      Gets the started secure (HTTPS) web server port.
      intgetWebServerPort()
      Gets the started web server port.
      intstartAgainWebServer​(java.lang.String extHostName, java.lang.String bind, int wsPort1, int wsPort2, int wsSecurePort1, int wsSecurePort2, java.security.KeyStore keyStore, java.lang.String pw, boolean useGzip)
      Restarts the web server once it is stopped.
      intstartWebServer​(IExternalBrowserPages extPages, IWSFileProviderServer fileProvider, WebSocketAcceptor acceptor, java.lang.String extServerURL, java.lang.String bind, int wsPort1, int wsPort2, int wsSecurePort1, int wsSecurePort2, java.security.KeyStore keyStore, java.lang.String pw, boolean useGzip)
      Starts the web server.
      booleanstopWebServer​(long maxTime)
      Stops the web server.
      • Methods inherited from class java.lang.Object

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

      • IntegratedWebServer

        public IntegratedWebServer​(java.util.Map<java.lang.String,​java.io.File> redirect,
                                   java.lang.String root)
        The constructor
    • Method Detail

      • startWebServer

        public int startWebServer​(IExternalBrowserPages extPages,
                                  IWSFileProviderServer fileProvider,
                                  WebSocketAcceptor acceptor,
                                  java.lang.String extServerURL,
                                  java.lang.String bind,
                                  int wsPort1,
                                  int wsPort2,
                                  int wsSecurePort1,
                                  int wsSecurePort2,
                                  java.security.KeyStore keyStore,
                                  java.lang.String pw,
                                  boolean useGzip)
        Starts the web server.
        Parameters:
        extPages - External pages implementor, null for none.
        fileProvider - File provider interface.
        acceptor - The acceptor for engine requests.
        extServerURL - External server URL, null to use canonical URL from ports.
        bind - Bind address, null for all.
        wsPort1 - HTTP port start port.
        wsPort2 - HTTP port start port (inclusive).
        wsSecurePort1 - HTTPS port start port.
        wsSecurePort2 - HTTPS port stop port (inclusive).
        keyStore - The KeyStore to use, null for self-signed.
        pw - The KeyStore password, null for self-signed.
        useGzip - Flag to use GZip or not.
        Returns:
        The port used, 0 for failure.
      • getExternalServerURL

        public java.lang.String getExternalServerURL()
        Returns the external server URL.
        Returns:
        The external web server base URL, or null for none.
      • getBindAddress

        public java.lang.String getBindAddress()
        Returns the bind address/name.
        Returns:
        The bind address or name, or null for none.
      • getWebServerPort

        public int getWebServerPort()
        Gets the started web server port.
        Returns:
        The port number, zero for not started.
      • getSecureWebServerPort

        public int getSecureWebServerPort()
        Gets the started secure (HTTPS) web server port.
        Returns:
        The port number, zero for not started.
      • 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​(java.lang.String name,
                                       java.io.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​(java.io.File originalFile,
                                       java.io.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.
      • startAgainWebServer

        public int startAgainWebServer​(java.lang.String extHostName,
                                       java.lang.String bind,
                                       int wsPort1,
                                       int wsPort2,
                                       int wsSecurePort1,
                                       int wsSecurePort2,
                                       java.security.KeyStore keyStore,
                                       java.lang.String pw,
                                       boolean useGzip)
        Restarts the web server once it is stopped.
        Parameters:
        extHostName - External host name, null to use canonical host name.
        bind - Bind address, null for all.
        wsPort1 - HTTP port start port.
        wsPort2 - HTTP port start port (inclusive).
        wsSecurePort1 - HTTPS port start port.
        wsSecurePort2 - HTTPS port stop port (inclusive).
        keyStore - The KeyStore to use, null for self-signed.
        pw - The KeyStore password, null for self-signed.
        useGzip - Flag to use GZip or not.
        Returns:
        The port used, 0 for failure.