public class SpincastConfigPropsFileBased extends SpincastConfigDefault implements SpincastConfig, FreeKeyConfig
| Modifier and Type | Field and Description |
|---|---|
static String |
APP_PROPERTIES_KEY_ENVIRONMENT_IS_DEBUG |
static String |
APP_PROPERTIES_KEY_ENVIRONMENT_NAME |
static String |
APP_PROPERTIES_KEY_HTTP_SERVER_PORT |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_KEYPASS |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_PATH |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_STOREPASS |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_TYPE |
static String |
APP_PROPERTIES_KEY_HTTPS_SERVER_PORT |
static String |
APP_PROPERTIES_KEY_SERVER_HOST |
protected org.slf4j.Logger |
logger |
ENVIRONMENT_NAME_DEFAULT| Constructor and Description |
|---|
SpincastConfigPropsFileBased(SpincastUtils spincastUtils,
String[] mainArgs,
SpincastConfigPropsFileBasedConfig pluginConfig)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected Properties |
getAppProperties()
Here is the algorithm used to find the configuration file :
1) If getSpecificAppPropertiesFilePath() is not
null,
we use it as the path. |
String |
getConfig(String key)
Gets a String configuration and throws an exception if the
specified key is not found.
|
protected Object |
getConfig(String key,
Object defaultValue,
boolean useDefaultValue)
Gets a configuration.
|
String |
getConfig(String key,
String defaultValue)
Gets a String configuration and uses the specified default value if the
key is not found.
|
Boolean |
getConfigBoolean(String key)
Gets a boolean configuration and throws an exception if the
specified key is not found.
|
Boolean |
getConfigBoolean(String key,
Boolean defaultValue)
Gets a boolean configuration and uses the specified default value if the
key is not found.
|
Integer |
getConfigInteger(String key)
Gets a integer configuration and throws an exception if the
specified key is not found.
|
Integer |
getConfigInteger(String key,
Integer defaultValue)
Gets a integer configuration and uses the specified default value if the
key is not found.
|
protected String |
getConfigKeyEnvironmentIsDebug() |
protected String |
getConfigKeyEnvironmentName() |
protected String |
getConfigKeyHttpServerPort() |
protected String |
getConfigKeyHttpsServerKeystoreKeyPass() |
protected String |
getConfigKeyHttpsServerKeystorePath() |
protected String |
getConfigKeyHttpsServerKeystoreStorePass() |
protected String |
getConfigKeyHttpsServerKeystoreType() |
protected String |
getConfigKeyHttpsServerPort() |
protected String |
getConfigKeyServerHost() |
String |
getEnvironmentName()
Returns the name of the environment.
|
protected String |
getFoundPropertiesFilePath()
The path to the acutally found .properties file.
|
int |
getHttpServerPort()
The HTTP (unsecure) port on which the server will listen on.
|
String |
getHttpsKeyStoreKeypass()
The "keypass" of the
KeyStore, for SSL. |
String |
getHttpsKeyStorePath()
The path to the
KeyStore, for SSL. |
String |
getHttpsKeyStoreStorePass()
The "storepass" of the
KeyStore, for SSL. |
String |
getHttpsKeyStoreType()
The type of the
KeyStore, for SSL. |
int |
getHttpsServerPort()
The HTTPS (secure) port on which the server will listen on.
|
protected String[] |
getMainArgs() |
protected SpincastConfigPropsFileBasedConfig |
getPluginConfig() |
String |
getPublicServerSchemeHostPort()
You should override this config!!!!
|
String |
getQueryParamFlashMessageId()
The name of the queryString parameter to use
for a Flash Message id, when cookies are not
available.
|
String |
getServerHost()
The host/IP on which the server will listen to.
|
protected String |
getSpecificAppPropertiesFilePath() |
protected SpincastUtils |
getSpincastUtils() |
boolean |
isDebugEnabled()
Let this to
true on development environment,
where errors can be publicly displayed, where cache can
be disabled, etc. |
protected String |
lookForPropsFileSpecificPath()
Look for a specific .properties file.
|
cleanWritableSpincastDir, getContentTypesToSkipGziping, getCookieNameFlashMessage, getCookieNameLocale, getCookiesValidatorCookieName, getDefaultLocale, getDefaultRouteCacheFilterSecondsNbr, getDefaultRouteCacheFilterSecondsNbrCdns, getDefaultStaticResourceCacheConfig, getDefaultTemplateVariablesFilterPosition, getHostForDefaultPublicServerSchemeHostPort, getJsonPathArrayIndexMax, getKeyMaxLengthWhenConvertingMapToJsonObject, getMaxNumberOfKeysWhenConvertingMapToJsonObject, getPublicServerHost, getPublicServerPort, getPublicServerScheme, getPubliURI, getRouteForwardingMaxNumber, getServerMaxRequestBodyBytes, getSpincastModelRootVariableName, getSpincastTempDirName, getSpincastWritableDir, isAddDefaultTemplateVariablesFilter, isDefaultRouteCacheFilterPrivate, isDisableWriteToDiskDynamicStaticResource, isEnableCookiesValidator, isRoutesCaseSensitive, isValidateLocalhostHostclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetContentTypesToSkipGziping, getCookieNameFlashMessage, getCookieNameLocale, getCookiesValidatorCookieName, getDefaultLocale, getDefaultRouteCacheFilterSecondsNbr, getDefaultRouteCacheFilterSecondsNbrCdns, getDefaultStaticResourceCacheConfig, getDefaultTemplateVariablesFilterPosition, getJsonPathArrayIndexMax, getKeyMaxLengthWhenConvertingMapToJsonObject, getMaxNumberOfKeysWhenConvertingMapToJsonObject, getPublicServerHost, getPublicServerPort, getPublicServerScheme, getRouteForwardingMaxNumber, getServerMaxRequestBodyBytes, getSpincastModelRootVariableName, getSpincastWritableDir, isAddDefaultTemplateVariablesFilter, isDefaultRouteCacheFilterPrivate, isDisableWriteToDiskDynamicStaticResource, isEnableCookiesValidator, isRoutesCaseSensitive, isValidateLocalhostHostprotected final org.slf4j.Logger logger
public static final String APP_PROPERTIES_KEY_ENVIRONMENT_NAME
public static final String APP_PROPERTIES_KEY_ENVIRONMENT_IS_DEBUG
public static final String APP_PROPERTIES_KEY_SERVER_HOST
public static final String APP_PROPERTIES_KEY_HTTP_SERVER_PORT
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_PORT
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_PATH
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_TYPE
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_STOREPASS
public static final String APP_PROPERTIES_KEY_HTTPS_SERVER_KEYSTORE_KEYPASS
@Inject public SpincastConfigPropsFileBased(SpincastUtils spincastUtils, @Nullable String[] mainArgs, SpincastConfigPropsFileBasedConfig pluginConfig)
protected SpincastConfigPropsFileBasedConfig getPluginConfig()
protected SpincastUtils getSpincastUtils()
protected String[] getMainArgs()
protected String getSpecificAppPropertiesFilePath()
protected String lookForPropsFileSpecificPath()
protected String getFoundPropertiesFilePath()
null if
none was found.protected String getConfigKeyEnvironmentName()
protected String getConfigKeyEnvironmentIsDebug()
protected String getConfigKeyServerHost()
protected String getConfigKeyHttpServerPort()
protected String getConfigKeyHttpsServerPort()
protected String getConfigKeyHttpsServerKeystorePath()
protected String getConfigKeyHttpsServerKeystoreType()
protected String getConfigKeyHttpsServerKeystoreStorePass()
protected String getConfigKeyHttpsServerKeystoreKeyPass()
protected Properties getAppProperties()
null,
we use it as the path.
2) Otherwise, we try to find the configuration file next to the ".jar"
itself.
3) It we didn't found the configuration file next to the ".jar" file,
or if there is no .jar file (the code is running from an IDE, for example),
then we fallback to the default configurations which are defined in the
SpincastConfig base class.public String getConfig(String key)
getConfig in interface FreeKeyConfigpublic String getConfig(String key, String defaultValue)
getConfig in interface FreeKeyConfigpublic Boolean getConfigBoolean(String key)
getConfigBoolean in interface FreeKeyConfigpublic Boolean getConfigBoolean(String key, Boolean defaultValue)
getConfigBoolean in interface FreeKeyConfigpublic Integer getConfigInteger(String key)
getConfigInteger in interface FreeKeyConfigpublic Integer getConfigInteger(String key, Integer defaultValue)
getConfigInteger in interface FreeKeyConfigprotected Object getConfig(String key, Object defaultValue, boolean useDefaultValue)
public String getEnvironmentName()
SpincastConfiglocal.getEnvironmentName in interface SpincastConfiggetEnvironmentName in class SpincastConfigDefaultpublic boolean isDebugEnabled()
SpincastConfigtrue on development environment,
where errors can be publicly displayed, where cache can
be disabled, etc. In production set it to false
The default value is true.isDebugEnabled in interface SpincastConfigisDebugEnabled in class SpincastConfigDefaulttrue if debug mode is enabled.public String getServerHost()
SpincastConfig0.0.0.0.getServerHost in interface SpincastConfiggetServerHost in class SpincastConfigDefaultpublic int getHttpServerPort()
SpincastConfig44419 so HTTP
is enabled by default.getHttpServerPort in interface SpincastConfiggetHttpServerPort in class SpincastConfigDefaultpublic int getHttpsServerPort()
SpincastConfig-1 so HTTPS
is not enabled by default.getHttpsServerPort in interface SpincastConfiggetHttpsServerPort in class SpincastConfigDefaultpublic String getHttpsKeyStorePath()
SpincastConfigKeyStore, for SSL. Can be a
classpath path or and absolute path.
The classpath will be checked first.
Only used if getHttpsServerPort() returns a port > 0.
The default value is null.getHttpsKeyStorePath in interface SpincastConfiggetHttpsKeyStorePath in class SpincastConfigDefaultKeyStorepublic String getHttpsKeyStoreType()
SpincastConfigKeyStore, for SSL.
For example: "JKS".
Only used if getHttpsServerPort() returns a port > 0.
The default value is null.getHttpsKeyStoreType in interface SpincastConfiggetHttpsKeyStoreType in class SpincastConfigDefaultKeyStorepublic String getHttpsKeyStoreStorePass()
SpincastConfigKeyStore, for SSL.
Only used if getHttpsServerPort() returns a port > 0.
The default value is null.getHttpsKeyStoreStorePass in interface SpincastConfiggetHttpsKeyStoreStorePass in class SpincastConfigDefaultKeyStorepublic String getHttpsKeyStoreKeypass()
SpincastConfigKeyStore, for SSL.
Only used if getHttpsServerPort() returns a port > 0.
The default value is null.getHttpsKeyStoreKeypass in interface SpincastConfiggetHttpsKeyStoreKeypass in class SpincastConfigDefaultKeyStorepublic String getPublicServerSchemeHostPort()
SpincastConfigDefaultgetPublicServerSchemeHostPort in interface SpincastConfiggetPublicServerSchemeHostPort in class SpincastConfigDefaultpublic String getQueryParamFlashMessageId()
SpincastConfiggetQueryParamFlashMessageId in interface SpincastConfiggetQueryParamFlashMessageId in class SpincastConfigDefaultCopyright © 2016. All rights reserved.