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 StringDEFAULT_CONTEXT_PATHstatic StringDEFAULT_DEV_NINJA_SSL_KEYSTORE_PASSWORDstatic StringDEFAULT_DEV_NINJA_SSL_KEYSTORE_URIstatic StringDEFAULT_DEV_NINJA_SSL_TRUSTSTORE_PASSWORDstatic StringDEFAULT_DEV_NINJA_SSL_TRUSTSTORE_URIstatic StringDEFAULT_HOSTstatic LongDEFAULT_IDLE_TIMEOUTstatic IntegerDEFAULT_PORTstatic IntegerDEFAULT_SSL_PORTstatic StringDEFAULT_STANDALONE_CLASSstatic StringKEY_NINJA_CONTEXT_PATHstatic StringKEY_NINJA_HOSTstatic StringKEY_NINJA_IDLE_TIMEOUTstatic StringKEY_NINJA_PORTstatic StringKEY_NINJA_SSL_KEYSTORE_PASSWORDstatic StringKEY_NINJA_SSL_KEYSTORE_URIstatic StringKEY_NINJA_SSL_PORTstatic StringKEY_NINJA_SSL_TRUSTSTORE_PASSWORDstatic StringKEY_NINJA_SSL_TRUSTSTORE_URIstatic StringKEY_NINJA_STANDALONE_CLASS
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TcontextPath(String contextPath)Sets the "context path" of the Ninja application.List<String>getBaseUrls()Get the urls for the application that is configured to start.StringgetContextPath()StringgetHost()LonggetIdleTimeout()IntegergetPort()List<String>getServerUrls()Get the urls for the servers that are configured to start.StringgetSslKeystorePassword()URIgetSslKeystoreUri()IntegergetSslPort()StringgetSslTruststorePassword()URIgetSslTruststoreUri()Thost(String host)TidleTimeout(long idleTimeout)booleanisPortEnabled()Tests if the clear text HTTP port is enabled.booleanisSslPortEnabled()Tests if the SSL HTTP port is enabled.Tjoin()Joins the underlying server to wait until its finished.Tport(int port)voidrun()Configure, start, add shutdown hook, and join.TsslKeystorePassword(String keystorePassword)TsslKeystoreUri(URI keystoreUri)TsslPort(int sslPort)TsslTruststorePassword(String truststorePassword)TsslTruststoreUri(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.
-
-