Class ServletContainerLauncher


  • public abstract class ServletContainerLauncher
    extends java.lang.Object
    Defines the service provider interface for launching servlet containers that can be used by the GWT development mode.

    Subclasses should be careful about calling any methods defined on this class or else they risk failing when used with a version of GWT that did not have those methods.

    • Constructor Detail

      • ServletContainerLauncher

        public ServletContainerLauncher()
    • Method Detail

      • getIconBytes

        public byte[] getIconBytes()
        Returns:
        byte array containing an icon (fitting into 24x24) to use for the server, or null if only the name should be used
      • getName

        public java.lang.String getName()
        Returns:
        a short human-readable name of this servlet container, or null if no name should be displayed.
      • isSecure

        public boolean isSecure()
        Return true if this servlet container launcher is configured for secure operation (ie, HTTPS). This value is only queried after arguments, if any, have been processed. The default implementation just returns false.
        Returns:
        true if HTTPS is in use
      • processArguments

        public boolean processArguments​(TreeLogger logger,
                                        java.lang.String arguments)
        Process any supplied arguments.

        Will be called before start(TreeLogger, int, File), if at all.

        Parameters:
        logger - logger to use for warnings/errors
        arguments - single string containing the arguments for this SCL, the format to be defined by the SCL
        Returns:
        true if the arguments were processed successfully
      • setBindAddress

        public void setBindAddress​(java.lang.String bindAddress)
        Set the bind address for the web server socket.

        Will be called before start(TreeLogger, int, File), if at all. If not called, the SCL should listen on all addresses.

        Parameters:
        bindAddress - host name or IP address, suitable for use with InetAddress.getByName(String)
      • start

        public abstract ServletContainer start​(TreeLogger logger,
                                               int port,
                                               java.io.File appRootDir)
                                        throws java.net.BindException,
                                               java.lang.Exception
        Start an embedded HTTP servlet container.
        Parameters:
        logger - the server logger
        port - the TCP port to serve on; if 0 is requested, a port should be automatically selected
        appRootDir - the base WAR directory
        Returns:
        the launched servlet container
        Throws:
        java.net.BindException - if the requested port is already in use
        java.lang.Exception - if the server fails to start for any other reason