public class Context extends Object
Holds the whole Dandelion context.
This class is in charge of discovering and storing several configuration
points, such as the configured RequestCache
implementation or the
active AssetProcessor
s.
There should be only one instance of this class per JVM.
Constructor and Description |
---|
Context(javax.servlet.FilterConfig filterConfig)
Public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
List<AssetProcessor> |
getActiveProcessors() |
AssetVersioningStrategy |
getActiveVersioningStrategy() |
Map<String,AssetLocator> |
getAssetLocatorsMap() |
AssetStorage |
getAssetStorage() |
List<BundleLoader> |
getBundleLoaders() |
BundleStorage |
getBundleStorage() |
RequestCache |
getCache() |
CacheManager |
getCacheManager() |
Configuration |
getConfiguration() |
Map<String,DebugMenu> |
getDebugMenuMap() |
Map<String,DebugPage> |
getDebugPageMap() |
HandlerChain |
getPostHandlerChain() |
HandlerChain |
getPreHandlerChain() |
AssetProcessorManager |
getProcessorManager() |
Map<String,AssetProcessor> |
getProcessorsMap() |
Cache<String,RequestFlashData> |
getRequestFlashDataCache() |
Map<String,AssetVersioningStrategy> |
getVersioningStrategyMap() |
void |
init(javax.servlet.FilterConfig filterConfig)
Performs all the required initializations of the Dandelion context.
|
void |
initAssetLocators()
Initializes all service providers of the
AssetLocator SPI. |
void |
initAssetProcessors()
Initializes all service providers of the
AssetProcessor SPI and
stores them all in the processorsMap . |
void |
initAssetStorage() |
void |
initAssetVersioning()
Initializes the asset versioning for the whole application.
|
void |
initBundleLoaders()
Initializes the
BundleLoader s in a particular order:
First, the VendorBundleLoader which loads all "vendor bundles"
Then, all service providers of the BundleLoader SPI present in
the classpath
Finally the DandelionBundleLoader which loads all
"user bundles"
|
void |
initBundleStorage()
Initializes the
BundleStorage by using all configured
BundleLoader s. |
void |
initComponents() |
void |
initConfiguration(javax.servlet.FilterConfig filterConfig)
Returns an implementation of
ConfigurationLoader using the
following strategy:
Check first if the dandelion.confloader.class system
property is set and tries to instantiate it
Otherwise, instantiate the StandardConfigurationLoader which
reads properties files
|
void |
initDebugMenus() |
void |
initHandlers()
Initializes the handler chains to be invoked in the
DandelionFilter to preprocess requests and postprocess responses. |
void |
initMBean(javax.servlet.FilterConfig filterConfig)
If JMX is enabled, initializes a MBean allowing to reload bundles and
access cache.
|
void |
initRequestCache()
Initialize the service provider of
RequestCache to use for
caching. |
void |
initRequestFlashDataCache()
Initialize the request flash data cache only if Thymeleaf is present in
the classpath.
|
boolean |
isDevProfileEnabled() |
boolean |
isProdProfileEnabled() |
public Context(javax.servlet.FilterConfig filterConfig)
Public constructor.
filterConfig
- The servlet filter configuration.public void init(javax.servlet.FilterConfig filterConfig)
Performs all the required initializations of the Dandelion context.
filterConfig
- The servlet filter configuration.public void initComponents()
public void initConfiguration(javax.servlet.FilterConfig filterConfig)
Returns an implementation of ConfigurationLoader
using the
following strategy:
dandelion.confloader.class
system
property is set and tries to instantiate itStandardConfigurationLoader
which
reads properties filespublic void initAssetVersioning()
Initializes the asset versioning for the whole application.
public void initBundleLoaders()
Initializes the BundleLoader
s in a particular order:
VendorBundleLoader
which loads all "vendor bundles"
BundleLoader
SPI present in
the classpathDandelionBundleLoader
which loads all
"user bundles"public void initRequestFlashDataCache()
Initialize the request flash data cache only if Thymeleaf is present in the classpath.
public void initRequestCache()
Initialize the service provider of RequestCache
to use for
caching.
public void initAssetLocators()
Initializes all service providers of the AssetLocator
SPI. The
order doesn't matter.
public void initAssetProcessors()
Initializes all service providers of the AssetProcessor
SPI and
stores them all in the processorsMap
.
If minification is enabled, the activeProcessors
is filled with
default service providers.
public void initBundleStorage()
Initializes the BundleStorage
by using all configured
BundleLoader
s.
Once loader, some checks are performed on the BundleStorage
.
public void initAssetStorage()
public void initMBean(javax.servlet.FilterConfig filterConfig)
If JMX is enabled, initializes a MBean allowing to reload bundles and access cache.
filterConfig
- The servlet filter configuration.public void initHandlers()
Initializes the handler chains to be invoked in the
DandelionFilter
to preprocess requests and postprocess responses.
public void initDebugMenus()
public void destroy()
public RequestCache getCache()
public Map<String,AssetProcessor> getProcessorsMap()
AssetProcessor
.public List<BundleLoader> getBundleLoaders()
public Map<String,AssetLocator> getAssetLocatorsMap()
AssetLocator
.public List<AssetProcessor> getActiveProcessors()
public BundleStorage getBundleStorage()
public AssetStorage getAssetStorage()
public AssetProcessorManager getProcessorManager()
public CacheManager getCacheManager()
public Configuration getConfiguration()
Configuration
store associated to the Dandelion
Context
.public boolean isDevProfileEnabled()
true
if the current Profile
is set to "dev" or any
other aliases present in Profile.DEV_ALIASES
,
false
otherwise.public boolean isProdProfileEnabled()
true
if the current Profile
is set to "prod" or
any other aliases present in Profile.PROD_ALIASES
,
false
otherwise.public AssetVersioningStrategy getActiveVersioningStrategy()
AssetVersioningStrategy
.public Map<String,AssetVersioningStrategy> getVersioningStrategyMap()
AssetVersioningStrategy
.public HandlerChain getPreHandlerChain()
HandlerChain
to be invoked in the
DandelionFilter
to preprocess requests.public HandlerChain getPostHandlerChain()
HandlerChain
to be invoked in the
DandelionFilter
to postprocess server responses.public Cache<String,RequestFlashData> getRequestFlashDataCache()
Copyright © 2013-2015 Dandelion Project. All Rights Reserved.