Interface Standalone<T extends Standalone>

  • Type Parameters:
    T - The concrete standalone implementation (to make the builder pattern work correctly during compilation)
    All Superinterfaces:
    Console<T>
    All Known Implementing Classes:
    AbstractStandalone

    public interface Standalone<T extends Standalone>
    extends Console<T>
    Interface for wrapping an underlying server (e.g. Jetty) to bootstrap Ninja as a standalone application.
    • Method Detail

      • run

        void run()
        Configure, start, add shutdown hook, and join. Since this method joins the underlying server (e.g. Jetty), it does not exit until interrupted.
      • join

        T join()
        throws Exception
        Joins the underlying server to wait until its finished.
        Returns:
        This standalone
        Throws:
        Exception - Thrown if an exception occurs while waiting
      • port

        T port​(int port)
      • getContextPath

        String getContextPath()
      • contextPath

        T contextPath​(String contextPath)
        Sets the "context path" of the Ninja application. Must follow servlet spects where it starts with a "/" and does not end with a "/". https://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#getContextPath()
        Parameters:
        contextPath - The context path such as "/mycontext"
        Returns:
        This standalone
        Throws:
        IllegalArgumentException - Thrown if the context value is not valid
      • idleTimeout

        T idleTimeout​(long idleTimeout)
      • getIdleTimeout

        Long getIdleTimeout()
      • sslPort

        T sslPort​(int sslPort)
      • getSslKeystoreUri

        URI getSslKeystoreUri()
      • sslKeystoreUri

        T sslKeystoreUri​(URI keystoreUri)
      • getSslKeystorePassword

        String getSslKeystorePassword()
      • sslKeystorePassword

        T sslKeystorePassword​(String keystorePassword)
      • getSslTruststoreUri

        URI getSslTruststoreUri()
      • sslTruststoreUri

        T sslTruststoreUri​(URI truststoreUri)
      • getSslTruststorePassword

        String getSslTruststorePassword()
      • sslTruststorePassword

        T sslTruststorePassword​(String truststorePassword)
      • getServerUrls

        List<String> getServerUrls()
        Get the urls for the servers that are configured to start. This value does not include the configured contextPath. Returns a value in the form 'scheme://host:port'. Well-known scheme and port combinations will not include the port.
        Returns:
        The urls of the server such as http://localhost:8080
        See Also:
        getServerUrls()
      • getBaseUrls

        List<String> getBaseUrls()
        Get the urls for the application that is configured to start. This value includes the configured contextPath. Returns a value in form 'scheme://host:port/context'. Well-known scheme and port combinations will not include the port.
        Returns:
        The uri(s) of the application such as http://localhost:8080/context
        See Also:
        getBaseUrls()
      • isPortEnabled

        boolean isPortEnabled()
        Tests if the clear text HTTP port is enabled. Usually this indicates the "ninja.port" property is > -1.
        Returns:
        True if enabled otherwise false.
      • isSslPortEnabled

        boolean isSslPortEnabled()
        Tests if the SSL HTTP port is enabled. Usually this indicates the "ninja.ssl.port" property is > -1.
        Returns:
        True if enabled otherwise false.