Interface SpincastConfig
- All Known Subinterfaces:
AppConfig
- All Known Implementing Classes:
AppConfig,AppConfigDefault,SpincastConfigDefault,SpincastConfigTestingDefault
-
Method Summary
Modifier and TypeMethodDescriptionEven if gziping of the response is enabled, those Content-Types still won't be gzipped.Name of the Cookie to to use save a Flash Message id.Name of the Cookie to use to save the userLocale.Name of the Cookie to use to save the id of the userTimeZone.Name of the Cookie to use to validate if cookies are enabled.The default Locale to use if no other Locale can be found as a "best match", for the current request.intWhen using the.cache()method on a route builder, this is the default number of seconds to use.When using the.cache()method on a route builder, this is the default number of seconds to use by the CDNs.getDefaultStaticResourceCacheConfig(boolean isDynamicResource) The default cache configurations for the static resource.intIfaddGlobalTemplateVariablesAdderFilterreturnstrue, then this is the position at which the filter will be added.The default TimeZone to use if no other TimeZone can be found as a "best match", for the current request.If a dictionary key is not found, how must Spincast react?Returns the name of the environment.intThe HTTP (unsecure) port on which the server will listen on.The "keypass" of theKeyStore, for SSL.The path to theKeyStore, for SSL.The "storepass" of theKeyStore, for SSL.The type of theKeyStore, for SSL.intThe HTTPS (secure) port on which the server will listen on.intGets the maximum index of an element of an array, when parsing aJsonPath.intintGets the maximum number ofkeysin a Map that can be parsed asJsonPathsto create aJsonObject.The public hostintThe public portThe public schemeThe application can't know by itself on which scheme/host/port it is served publicly.The name of the queryString parameter to use for a Flash Message id, when cookies are not available.intThe maximum number of time a request can be forwarded to another route.The host/IP on which the server will listen to.longMaximum number of bytes a request's body can have.Name of the root variables reserved for Spincast in the response's model.A directory where temp files can be written by Spincast.The default name to use for the validation element that will be available on the response's model whenFormelements are added.A directory where generated files can be written by Spincast.booleanShould the GlobalTemplateVariablesAdderFilter be automatically added to all routes?booleanWhen using the.cache()method on a route builder, is the cache private by default?booleanLet this totrueon a development environment, where errors can be publicly displayed, where cache can be disabled, where class redefinition can be done, etc.booleanIftrue, Spincast will always try to set a cookie to validate if cookies are enabled on the client.booleanShouldHTTP/2be enabled on the embeddedServer, if its supports it? Note that Undertow, the default server provided with Spincast, does support it.booleanAre the URLS case-sensitive or not, during the route matching process? The default value isfalse.booleanReturnstrueif the context has been created for running tests.booleanBy default, ifgetPublicServerHost()returns"localhost",getEnvironmentName()is not"local"andisDevelopmentMode()is false, an exception is thrown when the application starts.booleanIftrue, the dynamic resources (static resource which have a generator in case they don't exist) won't be saved to disk.
-
Method Details
-
getEnvironmentName
String getEnvironmentName()Returns the name of the environment. The default value islocal.- Returns:
- the name of the environment
-
isDevelopmentMode
boolean isDevelopmentMode()Let this totrueon a development environment, where errors can be publicly displayed, where cache can be disabled, where class redefinition can be done, etc.In production set it to
falseThe default value is
true.- Returns:
trueif debug mode is enabled.
-
isTestingMode
boolean isTestingMode()Returnstrueif the context has been created for running tests.For example, this would by default disable the scheduled tasks to be registered.
-
getPublicUrlBase
String getPublicUrlBase()The application can't know by itself on which scheme/host/port it is served publicly.For example, the server can be started using host "0.0.0.0", but the public URL to reach the application will be
http://www.example.com. The port can also be different, for example if a reverse-proxy is used.We need the public informations, for example :
- To build absolute URLs
-
To create a cookie with an approriate
domain, when none is specified. - ...
-
getPublicServerScheme
String getPublicServerScheme()The public scheme -
getPublicServerHost
String getPublicServerHost()The public host -
getPublicServerPort
int getPublicServerPort()The public port -
getServerHost
String getServerHost()The host/IP on which the server will listen to. The default value is0.0.0.0.- Returns:
- the host/IP
-
getHttpServerPort
int getHttpServerPort()The HTTP (unsecure) port on which the server will listen on. If <= 0, it won't be used. The default value is44419so HTTP is enabled by default.- Returns:
- the HTTP port
-
getHttpsServerPort
int getHttpsServerPort()The HTTPS (secure) port on which the server will listen on. If <= 0, it won't be used. The default value is-1so HTTPS is not enabled by default.- Returns:
- the HTTPS port
-
getHttpsKeyStorePath
String getHttpsKeyStorePath()The path to theKeyStore, for SSL. Can be a classpath path or and absolute path. The classpath will be checked first. Only used ifgetHttpsServerPort()returns a port > 0. The default value isnull.- Returns:
- the path to the
KeyStore
-
getHttpsKeyStoreType
String getHttpsKeyStoreType()The type of theKeyStore, for SSL. For example: "JKS". Only used ifgetHttpsServerPort()returns a port > 0. The default value isnull.- Returns:
- the type of the
KeyStore
-
getHttpsKeyStoreStorePass
String getHttpsKeyStoreStorePass()The "storepass" of theKeyStore, for SSL. Only used ifgetHttpsServerPort()returns a port > 0. The default value isnull.- Returns:
- the "storepass" of the
KeyStore
-
getHttpsKeyStoreKeyPass
String getHttpsKeyStoreKeyPass()The "keypass" of theKeyStore, for SSL. Only used ifgetHttpsServerPort()returns a port > 0. The default value isnull.- Returns:
- the "keypass" of the
KeyStore
-
isRoutesCaseSensitive
boolean isRoutesCaseSensitive()Are the URLS case-sensitive or not, during the route matching process? The default value isfalse.- Returns:
- if they are case-sensitive
- See Also:
-
getServerMaxRequestBodyBytes
long getServerMaxRequestBodyBytes()Maximum number of bytes a request's body can have. "-1" means no limit. The default value is104857600(100MB).- Returns:
- the maximum number of bytes
-
isEnableHttp2
boolean isEnableHttp2()ShouldHTTP/2be enabled on the embeddedServer, if its supports it? Note that Undertow, the default server provided with Spincast, does support it.Defaults to
true. -
getContentTypesToSkipGziping
Even if gziping of the response is enabled, those Content-Types still won't be gzipped. If an entry ends with "*", it will be considered as a prefix (ex: "image/*" will match all Content-Types starting with "image/"). Otherwise, the current response Content-Type will have to exactly match the entry (case insensitive), or being followed by a " " or a ";".- Returns:
- the Content-Types that shouldn't be gzipped.
-
getWritableRootDir
File getWritableRootDir()A directory where generated files can be written by Spincast.This directory won't be emptied each time the application starts, but its sub solder "temp" will be!
The default value uses
System.getProperty("java.io.tmpdir")to create the directory.- Returns:
- a directory with write permissions for Spincast.
-
getTempDir
File getTempDir()A directory where temp files can be written by Spincast.This directory will be emptied each time the application starts!
-
getDefaultLocale
Locale getDefaultLocale()The default Locale to use if no other Locale can be found as a "best match", for the current request. The default value isLocale.US.- Returns:
- the default Locale
-
getDefaultTimeZone
TimeZone getDefaultTimeZone()The default TimeZone to use if no other TimeZone can be found as a "best match", for the current request. The default value isUTC.- Returns:
- the default TimeZone
-
getRouteForwardingMaxNumber
int getRouteForwardingMaxNumber()The maximum number of time a request can be forwarded to another route. After this number, an exception will be thrown. The default value is2.- Returns:
- the maximum number of time
-
getDefaultRouteCacheFilterSecondsNbr
int getDefaultRouteCacheFilterSecondsNbr()When using the.cache()method on a route builder, this is the default number of seconds to use. -
isDefaultRouteCacheFilterPrivate
boolean isDefaultRouteCacheFilterPrivate()When using the.cache()method on a route builder, is the cache private by default? -
getDefaultRouteCacheFilterSecondsNbrCdns
Integer getDefaultRouteCacheFilterSecondsNbrCdns()When using the.cache()method on a route builder, this is the default number of seconds to use by the CDNs. -
getDefaultStaticResourceCacheConfig
The default cache configurations for the static resource.This will be used if no
cache(...)method is used when building the static resource's route.- Parameters:
isDynamicResource- iftrue, a generator is use when the resource doesn't exist. Those kind of generated resources may be modified more often then trully static resources, so we may want to use a different caching period.- Returns:
- the default cache configuration to use or
nullso no cache headers are sent at all.
-
isWriteToDiskDynamicStaticResource
boolean isWriteToDiskDynamicStaticResource()Iftrue, the dynamic resources (static resource which have a generator in case they don't exist) won't be saved to disk. This means that the generator will always be called, so changes during development will be picked up. -
isAddDefaultTemplateVariablesFilter
boolean isAddDefaultTemplateVariablesFilter()Should the GlobalTemplateVariablesAdderFilter be automatically added to all routes?This filter bind some default variables to be used by the templating engine.
-
getDefaultTemplateVariablesFilterPosition
int getDefaultTemplateVariablesFilterPosition()IfaddGlobalTemplateVariablesAdderFilterreturnstrue, then this is the position at which the filter will be added. -
getMaxNumberOfKeysWhenConvertingMapToJsonObject
int getMaxNumberOfKeysWhenConvertingMapToJsonObject()Gets the maximum number ofkeysin a Map that can be parsed asJsonPathsto create aJsonObject.This maximum is to prevent malicious user to POST a very big number of
keysand harm the server. -
getKeyMaxLengthWhenConvertingMapToJsonObject
int getKeyMaxLengthWhenConvertingMapToJsonObject()Gets the maximum length of akeyin a Map that can be parsed asJsonPathsusing thecreatemethod.This maximum is to prevent malicious user to POST very long and complex
keysand harm the server. -
getJsonPathArrayIndexMax
int getJsonPathArrayIndexMax()Gets the maximum index of an element of an array, when parsing aJsonPath. -
isValidateLocalhostHost
boolean isValidateLocalhostHost()By default, ifgetPublicServerHost()returns"localhost",getEnvironmentName()is not"local"andisDevelopmentMode()is false, an exception is thrown when the application starts.This validation is to make sure the developers didn't forget to override the
getPublicUrlBase()method when they release to a non local environment.You can disable this validation if you want.
-
isEnableCookiesValidator
boolean isEnableCookiesValidator()Iftrue, Spincast will always try to set a cookie to validate if cookies are enabled on the client.This is enabled by default
-
getCookiesValidatorCookieName
String getCookiesValidatorCookieName()Name of the Cookie to use to validate if cookies are enabled.The default is "spincast_cookies_enabled".
-
getCookieNameFlashMessage
String getCookieNameFlashMessage()Name of the Cookie to to use save a Flash Message id. -
getQueryParamFlashMessageId
String getQueryParamFlashMessageId()The name of the queryString parameter to use for a Flash Message id, when cookies are not available. -
getCookieNameLocale
String getCookieNameLocale()Name of the Cookie to use to save the userLocale.The default is "spincast_locale"
-
getCookieNameTimeZoneId
String getCookieNameTimeZoneId()Name of the Cookie to use to save the id of the userTimeZone.The default is "spincast_timezone"
-
getSpincastModelRootVariableName
String getSpincastModelRootVariableName()Name of the root variables reserved for Spincast in the response's model. -
getValidationElementDefaultName
String getValidationElementDefaultName()The default name to use for the validation element that will be available on the response's model whenFormelements are added. -
getDictionaryEntryNotFoundBehavior
DictionaryEntryNotFoundBehavior getDictionaryEntryNotFoundBehavior()If a dictionary key is not found, how must Spincast react?Note that if the key is not found for the current Locale, Spincast will first check if it exists for the fallback Locale (the empty Locale).
By default, in debug mode an exception is thrown. Otherwise, an empty string is returned but an error is logged.
-