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 booleanprotected org.craftercms.core.util.cache.CacheTemplateprotected SiteCacheWarmerprotected booleanstatic final Stringstatic final Stringprotected String[]protected org.craftercms.commons.config.EncryptionAwareConfigurationReaderprotected Stringstatic final longstatic final Stringstatic final longstatic final Stringprotected String[]protected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected org.springframework.beans.factory.ObjectFactory<org.springframework.web.servlet.view.freemarker.FreeMarkerConfig> protected org.springframework.context.ApplicationContextprotected GraphQLFactoryprotected Stringprotected booleanprotected Stringprotected longprotected List<ScriptJobResolver> protected Executorprotected MacroResolverprotected intprotected booleanprotected String[]protected Stringprotected org.craftercms.commons.config.PublishingTargetResolverprotected Stringprotected Stringprotected Stringprotected jakarta.servlet.ServletContextprotected longstatic final Stringstatic final Stringprotected Stringprotected Stringprotected org.craftercms.core.service.ContentStoreServiceprotected Stringprotected Stringprotected 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.LocaleResolverbuildLocaleResolver(org.apache.commons.configuration2.HierarchicalConfiguration<?> configuration) protected voidconfigureScriptSandbox(SiteContext siteContext, org.springframework.core.io.ResourceLoader resourceLoader) createContext(String siteName) protected org.springframework.context.ConfigurableApplicationContextgetApplicationContext(SiteContext siteContext, URLClassLoader classLoader, org.apache.commons.configuration2.HierarchicalConfiguration config, String[] applicationContextPaths, org.springframework.core.io.ResourceLoader resourceLoader) protected URLClassLoadergetClassLoader(SiteContext siteContext) protected org.apache.commons.configuration2.HierarchicalConfigurationgetConfig(SiteContext siteContext, String[] configPaths, org.springframework.core.io.ResourceLoader resourceLoader) protected org.apache.commons.configuration2.HierarchicalConfigurationgetProxyConfig(SiteContext siteContext, List<String> configPaths, org.springframework.core.io.ResourceLoader resourceLoader) protected ScriptFactorygetScriptFactory(SiteContext siteContext, URLClassLoader classLoader) protected org.apache.commons.configuration2.HierarchicalConfigurationgetTranslationConfig(SiteContext siteContext, List<String> configPaths, org.springframework.core.io.ResourceLoader resourceLoader) protected org.tuckey.web.filters.urlrewrite.UrlRewritergetUrlRewriter(SiteContext siteContext, String[] urlRewriteConfPaths, org.springframework.core.io.ResourceLoader resourceLoader) resolveRootFolderPath(String siteName) Resolve root folder pathprotected org.quartz.SchedulerscheduleJobs(SiteContext siteContext) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetCacheOn(boolean cacheOn) voidsetDefaultPublicBeans(String[] defaultPublicBeans) voidsetDisableVariableRestrictions(boolean disableVariableRestrictions) voidsetEnableExpressions(boolean enableExpressions) voidsetEnableSandboxBlacklist(boolean enableSandboxBlacklist) voidsetEnableScriptSandbox(boolean enableScriptSandbox) voidsetEnableTranslation(boolean enableTranslation) voidsetIgnoreHiddenFiles(boolean ignoreHiddenFiles) voidsetInitTimeout(long initTimeout) voidsetMaxAllowedItemsInCache(int maxAllowedItemsInCache) voidsetMergingOn(boolean mergingOn) voidsetPublishingTargetResolver(org.craftercms.commons.config.PublishingTargetResolver publishingTargetResolver) voidsetSandboxBlacklist(String sandboxBlacklist) voidsetServletContext(jakarta.servlet.ServletContext servletContext) voidsetShutdownTimeout(long shutdownTimeout) voidsetSiteNameMacroName(String siteNameMacroName) voidsetTranslationConfigPaths(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:
setServletContextin 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:
setApplicationContextin 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
-