Class SiteContextFactory
java.lang.Object
org.craftercms.engine.service.context.SiteContextFactory
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
,org.springframework.web.context.ServletContextAware
public class SiteContextFactory
extends Object
implements org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware
Factory for creating
SiteContext
with common properties. It also uses the MacroResolver
to resolve
any macros specified in the rootFolderPath
before creating the context (remember that macros can vary
between requests).- Author:
- Alfonso Vásquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String[]
protected boolean
protected org.craftercms.core.util.cache.CacheTemplate
protected SiteCacheWarmer
protected boolean
static final String
static final String
protected String[]
protected org.craftercms.commons.config.EncryptionAwareConfigurationReader
protected String
static final long
static final String
static final long
static final String
protected String[]
protected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected org.springframework.beans.factory.ObjectFactory
<org.springframework.web.servlet.view.freemarker.FreeMarkerConfig> protected org.springframework.context.ApplicationContext
protected GraphQLFactory
protected String
protected boolean
protected String
protected long
protected List
<ScriptJobResolver> protected Executor
protected MacroResolver
protected int
protected boolean
protected String[]
protected String
protected org.craftercms.commons.config.PublishingTargetResolver
protected String
protected String
protected String
protected jakarta.servlet.ServletContext
protected long
static final String
static final String
protected String
protected String
protected org.craftercms.core.service.ContentStoreService
protected String
protected String
protected String[]
protected String[]
protected org.craftercms.core.url.UrlTransformationEngine
-
Constructor Summary
ConstructorsConstructorDescriptionSiteContextFactory
(String storeType, String rootFolderPath, String staticAssetsPath, String templatesPath, String initScriptPath, String restScriptsPath, String controllerScriptsPath, String[] configPaths, String[] applicationContextPaths, String[] urlRewriteConfPaths, String[] proxyConfigPaths, String groovyClassesPath, Map<String, Object> groovyGlobalVars, org.springframework.beans.factory.ObjectFactory<org.springframework.web.servlet.view.freemarker.FreeMarkerConfig> freeMarkerConfigFactory, org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine, org.craftercms.core.service.ContentStoreService storeService, org.craftercms.core.util.cache.CacheTemplate cacheTemplate, MacroResolver macroResolver, List<ScriptJobResolver> jobResolvers, Executor jobThreadPoolExecutor, GraphQLFactory graphQLFactory, boolean cacheWarmUpEnabled, SiteCacheWarmer cacheWarmer, org.craftercms.commons.config.EncryptionAwareConfigurationReader configurationReader, String[] whitelistGetEnvRegex) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.web.servlet.LocaleResolver
buildLocaleResolver
(org.apache.commons.configuration2.HierarchicalConfiguration<?> configuration) protected void
configureScriptSandbox
(SiteContext siteContext, org.springframework.core.io.ResourceLoader resourceLoader) createContext
(String siteName) protected org.springframework.context.ConfigurableApplicationContext
getApplicationContext
(SiteContext siteContext, URLClassLoader classLoader, org.apache.commons.configuration2.HierarchicalConfiguration config, String[] applicationContextPaths, org.springframework.core.io.ResourceLoader resourceLoader) protected URLClassLoader
getClassLoader
(SiteContext siteContext) protected org.apache.commons.configuration2.HierarchicalConfiguration
getConfig
(SiteContext siteContext, String[] configPaths, org.springframework.core.io.ResourceLoader resourceLoader) protected org.apache.commons.configuration2.HierarchicalConfiguration
getProxyConfig
(SiteContext siteContext, List<String> configPaths, org.springframework.core.io.ResourceLoader resourceLoader) protected ScriptFactory
getScriptFactory
(SiteContext siteContext, URLClassLoader classLoader) protected org.apache.commons.configuration2.HierarchicalConfiguration
getTranslationConfig
(SiteContext siteContext, List<String> configPaths, org.springframework.core.io.ResourceLoader resourceLoader) protected org.tuckey.web.filters.urlrewrite.UrlRewriter
getUrlRewriter
(SiteContext siteContext, String[] urlRewriteConfPaths, org.springframework.core.io.ResourceLoader resourceLoader) resolveRootFolderPath
(String siteName) Resolve root folder pathprotected org.quartz.Scheduler
scheduleJobs
(SiteContext siteContext) void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setCacheOn
(boolean cacheOn) void
setDefaultPublicBeans
(String[] defaultPublicBeans) void
setDisableVariableRestrictions
(boolean disableVariableRestrictions) void
setEnableExpressions
(boolean enableExpressions) void
setEnableSandboxBlacklist
(boolean enableSandboxBlacklist) void
setEnableScriptSandbox
(boolean enableScriptSandbox) void
setEnableTranslation
(boolean enableTranslation) void
setIgnoreHiddenFiles
(boolean ignoreHiddenFiles) void
setInitTimeout
(long initTimeout) void
setMaxAllowedItemsInCache
(int maxAllowedItemsInCache) void
setMergingOn
(boolean mergingOn) void
setPublishingTargetResolver
(org.craftercms.commons.config.PublishingTargetResolver publishingTargetResolver) void
setSandboxBlacklist
(String sandboxBlacklist) void
setServletContext
(jakarta.servlet.ServletContext servletContext) void
setShutdownTimeout
(long shutdownTimeout) void
setSiteNameMacroName
(String siteNameMacroName) void
setTranslationConfigPaths
(String[] translationConfigPaths)
-
Field Details
-
DEFAULT_SITE_NAME_MACRO_NAME
- See Also:
-
SITE_NAME_CONFIG_VARIABLE
- See Also:
-
SITE_ID_CONFIG_VARIABLE
- See Also:
-
DEFAULT_INIT_TIMEOUT
public static final long DEFAULT_INIT_TIMEOUT- See Also:
-
CONFIG_BEAN_NAME
- See Also:
-
DEFAULT_SHUTDOWN_TIMEOUT
public static final long DEFAULT_SHUTDOWN_TIMEOUT- See Also:
-
DEFAULT_PUBLISHING_TARGET_MACRO_NAME
- See Also:
-
CONFIG_KEY_ALLOWED_TEMPLATE_PATHS
- See Also:
-
servletContext
protected jakarta.servlet.ServletContext servletContext -
siteNameMacroName
-
storeType
-
rootFolderPath
-
staticAssetsPath
-
templatesPath
-
initScriptPath
-
restScriptsPath
-
controllerScriptsPath
-
configPaths
-
applicationContextPaths
-
urlRewriteConfPaths
-
proxyConfigPaths
-
translationConfigPaths
-
groovyClassesPath
-
groovyGlobalVars
-
mergingOn
protected boolean mergingOn -
cacheOn
protected boolean cacheOn -
maxAllowedItemsInCache
protected int maxAllowedItemsInCache -
ignoreHiddenFiles
protected boolean ignoreHiddenFiles -
freeMarkerConfigFactory
protected org.springframework.beans.factory.ObjectFactory<org.springframework.web.servlet.view.freemarker.FreeMarkerConfig> freeMarkerConfigFactory -
urlTransformationEngine
protected org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine -
storeService
protected org.craftercms.core.service.ContentStoreService storeService -
cacheTemplate
protected org.craftercms.core.util.cache.CacheTemplate cacheTemplate -
macroResolver
-
globalApplicationContext
protected org.springframework.context.ApplicationContext globalApplicationContext -
jobResolvers
-
jobThreadPoolExecutor
-
graphQLFactory
-
cacheWarmUpEnabled
protected boolean cacheWarmUpEnabled -
cacheWarmer
-
initTimeout
protected long initTimeout -
configurationReader
protected org.craftercms.commons.config.EncryptionAwareConfigurationReader configurationReader -
disableVariableRestrictions
protected boolean disableVariableRestrictions -
defaultPublicBeans
-
shutdownTimeout
protected long shutdownTimeout -
publishingTargetResolver
protected org.craftercms.commons.config.PublishingTargetResolver publishingTargetResolver -
publishingTargetMacroName
-
enableScriptSandbox
protected boolean enableScriptSandbox -
enableSandboxBlacklist
protected boolean enableSandboxBlacklist -
sandboxBlacklist
-
enableExpressions
protected boolean enableExpressions -
enableTranslation
protected boolean enableTranslation -
whitelistGetEnvRegex
-
-
Constructor Details
-
SiteContextFactory
public SiteContextFactory(String storeType, String rootFolderPath, String staticAssetsPath, String templatesPath, String initScriptPath, String restScriptsPath, String controllerScriptsPath, String[] configPaths, String[] applicationContextPaths, String[] urlRewriteConfPaths, String[] proxyConfigPaths, String groovyClassesPath, Map<String, Object> groovyGlobalVars, org.springframework.beans.factory.ObjectFactory<org.springframework.web.servlet.view.freemarker.FreeMarkerConfig> freeMarkerConfigFactory, org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine, org.craftercms.core.service.ContentStoreService storeService, org.craftercms.core.util.cache.CacheTemplate cacheTemplate, MacroResolver macroResolver, List<ScriptJobResolver> jobResolvers, Executor jobThreadPoolExecutor, GraphQLFactory graphQLFactory, boolean cacheWarmUpEnabled, SiteCacheWarmer cacheWarmer, org.craftercms.commons.config.EncryptionAwareConfigurationReader configurationReader, String[] whitelistGetEnvRegex)
-
-
Method Details
-
setServletContext
public void setServletContext(jakarta.servlet.ServletContext servletContext) - Specified by:
setServletContext
in interfaceorg.springframework.web.context.ServletContextAware
-
setSiteNameMacroName
-
setTranslationConfigPaths
-
setMergingOn
public void setMergingOn(boolean mergingOn) -
setCacheOn
public void setCacheOn(boolean cacheOn) -
setMaxAllowedItemsInCache
public void setMaxAllowedItemsInCache(int maxAllowedItemsInCache) -
setIgnoreHiddenFiles
public void setIgnoreHiddenFiles(boolean ignoreHiddenFiles) -
setInitTimeout
public void setInitTimeout(long initTimeout) -
setDisableVariableRestrictions
public void setDisableVariableRestrictions(boolean disableVariableRestrictions) -
setDefaultPublicBeans
-
setShutdownTimeout
public void setShutdownTimeout(long shutdownTimeout) -
setPublishingTargetResolver
public void setPublishingTargetResolver(org.craftercms.commons.config.PublishingTargetResolver publishingTargetResolver) -
setEnableScriptSandbox
public void setEnableScriptSandbox(boolean enableScriptSandbox) -
setEnableSandboxBlacklist
public void setEnableSandboxBlacklist(boolean enableSandboxBlacklist) -
setSandboxBlacklist
-
setEnableExpressions
public void setEnableExpressions(boolean enableExpressions) -
setEnableTranslation
public void setEnableTranslation(boolean enableTranslation) -
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
createContext
-
resolveRootFolderPath
Resolve root folder path- Parameters:
siteName
- site name- Returns:
- the root folder absolute path
- Throws:
URISyntaxException
-
getConfig
protected org.apache.commons.configuration2.HierarchicalConfiguration getConfig(SiteContext siteContext, String[] configPaths, org.springframework.core.io.ResourceLoader resourceLoader) -
configureScriptSandbox
protected void configureScriptSandbox(SiteContext siteContext, org.springframework.core.io.ResourceLoader resourceLoader) -
getClassLoader
-
getApplicationContext
protected org.springframework.context.ConfigurableApplicationContext getApplicationContext(SiteContext siteContext, URLClassLoader classLoader, org.apache.commons.configuration2.HierarchicalConfiguration config, String[] applicationContextPaths, org.springframework.core.io.ResourceLoader resourceLoader) -
getUrlRewriter
protected org.tuckey.web.filters.urlrewrite.UrlRewriter getUrlRewriter(SiteContext siteContext, String[] urlRewriteConfPaths, org.springframework.core.io.ResourceLoader resourceLoader) -
getProxyConfig
protected org.apache.commons.configuration2.HierarchicalConfiguration getProxyConfig(SiteContext siteContext, List<String> configPaths, org.springframework.core.io.ResourceLoader resourceLoader) -
getTranslationConfig
protected org.apache.commons.configuration2.HierarchicalConfiguration getTranslationConfig(SiteContext siteContext, List<String> configPaths, org.springframework.core.io.ResourceLoader resourceLoader) -
buildLocaleResolver
protected org.springframework.web.servlet.LocaleResolver buildLocaleResolver(org.apache.commons.configuration2.HierarchicalConfiguration<?> configuration) -
getScriptFactory
-
scheduleJobs
-