Package ninja.standalone
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.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_CONTEXT_PATH
static String
DEFAULT_DEV_NINJA_SSL_KEYSTORE_PASSWORD
static String
DEFAULT_DEV_NINJA_SSL_KEYSTORE_URI
static String
DEFAULT_DEV_NINJA_SSL_TRUSTSTORE_PASSWORD
static String
DEFAULT_DEV_NINJA_SSL_TRUSTSTORE_URI
static String
DEFAULT_HOST
static Long
DEFAULT_IDLE_TIMEOUT
static Integer
DEFAULT_PORT
static Integer
DEFAULT_SSL_PORT
static String
DEFAULT_STANDALONE_CLASS
static String
KEY_NINJA_CONTEXT_PATH
static String
KEY_NINJA_HOST
static String
KEY_NINJA_IDLE_TIMEOUT
static String
KEY_NINJA_PORT
static String
KEY_NINJA_SSL_KEYSTORE_PASSWORD
static String
KEY_NINJA_SSL_KEYSTORE_URI
static String
KEY_NINJA_SSL_PORT
static String
KEY_NINJA_SSL_TRUSTSTORE_PASSWORD
static String
KEY_NINJA_SSL_TRUSTSTORE_URI
static String
KEY_NINJA_STANDALONE_CLASS
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
contextPath(String contextPath)
Sets the "context path" of the Ninja application.List<String>
getBaseUrls()
Get the urls for the application that is configured to start.String
getContextPath()
String
getHost()
Long
getIdleTimeout()
Integer
getPort()
List<String>
getServerUrls()
Get the urls for the servers that are configured to start.String
getSslKeystorePassword()
URI
getSslKeystoreUri()
Integer
getSslPort()
String
getSslTruststorePassword()
URI
getSslTruststoreUri()
T
host(String host)
T
idleTimeout(long idleTimeout)
boolean
isPortEnabled()
Tests if the clear text HTTP port is enabled.boolean
isSslPortEnabled()
Tests if the SSL HTTP port is enabled.T
join()
Joins the underlying server to wait until its finished.T
port(int port)
void
run()
Configure, start, add shutdown hook, and join.T
sslKeystorePassword(String keystorePassword)
T
sslKeystoreUri(URI keystoreUri)
T
sslPort(int sslPort)
T
sslTruststorePassword(String truststorePassword)
T
sslTruststoreUri(URI truststoreUri)
-
Methods inherited from interface ninja.standalone.Console
configure, externalConfigurationPath, getExternalConfigurationPath, getInjector, getName, getNinjaMode, getNinjaProperties, name, ninjaMode, overrideModule, overrideProperties, shutdown, start
-
-
-
-
Field Detail
-
KEY_NINJA_STANDALONE_CLASS
static final String KEY_NINJA_STANDALONE_CLASS
- See Also:
- Constant Field Values
-
KEY_NINJA_CONTEXT_PATH
static final String KEY_NINJA_CONTEXT_PATH
- See Also:
- Constant Field Values
-
KEY_NINJA_HOST
static final String KEY_NINJA_HOST
- See Also:
- Constant Field Values
-
KEY_NINJA_IDLE_TIMEOUT
static final String KEY_NINJA_IDLE_TIMEOUT
- See Also:
- Constant Field Values
-
KEY_NINJA_PORT
static final String KEY_NINJA_PORT
- See Also:
- Constant Field Values
-
KEY_NINJA_SSL_PORT
static final String KEY_NINJA_SSL_PORT
- See Also:
- Constant Field Values
-
KEY_NINJA_SSL_KEYSTORE_URI
static final String KEY_NINJA_SSL_KEYSTORE_URI
- See Also:
- Constant Field Values
-
KEY_NINJA_SSL_KEYSTORE_PASSWORD
static final String KEY_NINJA_SSL_KEYSTORE_PASSWORD
- See Also:
- Constant Field Values
-
KEY_NINJA_SSL_TRUSTSTORE_URI
static final String KEY_NINJA_SSL_TRUSTSTORE_URI
- See Also:
- Constant Field Values
-
KEY_NINJA_SSL_TRUSTSTORE_PASSWORD
static final String KEY_NINJA_SSL_TRUSTSTORE_PASSWORD
- See Also:
- Constant Field Values
-
DEFAULT_STANDALONE_CLASS
static final String DEFAULT_STANDALONE_CLASS
- See Also:
- Constant Field Values
-
DEFAULT_HOST
static final String DEFAULT_HOST
-
DEFAULT_PORT
static final Integer DEFAULT_PORT
-
DEFAULT_IDLE_TIMEOUT
static final Long DEFAULT_IDLE_TIMEOUT
-
DEFAULT_CONTEXT_PATH
static final String DEFAULT_CONTEXT_PATH
- See Also:
- Constant Field Values
-
DEFAULT_SSL_PORT
static final Integer DEFAULT_SSL_PORT
-
DEFAULT_DEV_NINJA_SSL_KEYSTORE_URI
static final String DEFAULT_DEV_NINJA_SSL_KEYSTORE_URI
- See Also:
- Constant Field Values
-
DEFAULT_DEV_NINJA_SSL_KEYSTORE_PASSWORD
static final String DEFAULT_DEV_NINJA_SSL_KEYSTORE_PASSWORD
- See Also:
- Constant Field Values
-
DEFAULT_DEV_NINJA_SSL_TRUSTSTORE_URI
static final String DEFAULT_DEV_NINJA_SSL_TRUSTSTORE_URI
- See Also:
- Constant Field Values
-
DEFAULT_DEV_NINJA_SSL_TRUSTSTORE_PASSWORD
static final String DEFAULT_DEV_NINJA_SSL_TRUSTSTORE_PASSWORD
- See Also:
- Constant Field Values
-
-
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
-
getHost
String getHost()
-
getPort
Integer getPort()
-
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()
-
getSslPort
Integer getSslPort()
-
sslPort
T sslPort(int sslPort)
-
getSslKeystoreUri
URI getSslKeystoreUri()
-
getSslKeystorePassword
String getSslKeystorePassword()
-
getSslTruststoreUri
URI getSslTruststoreUri()
-
getSslTruststorePassword
String getSslTruststorePassword()
-
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.
-
-