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 Details

    • DEFAULT_SITE_NAME_MACRO_NAME

      public static final String DEFAULT_SITE_NAME_MACRO_NAME
      See Also:
    • DEFAULT_INIT_TIMEOUT

      public static final long DEFAULT_INIT_TIMEOUT
      See Also:
    • CONFIG_BEAN_NAME

      public static final String CONFIG_BEAN_NAME
      See Also:
    • DEFAULT_SHUTDOWN_TIMEOUT

      public static final long DEFAULT_SHUTDOWN_TIMEOUT
      See Also:
    • DEFAULT_PUBLISHING_TARGET_MACRO_NAME

      public static final String DEFAULT_PUBLISHING_TARGET_MACRO_NAME
      See Also:
    • CONFIG_KEY_ALLOWED_TEMPLATE_PATHS

      public static final String CONFIG_KEY_ALLOWED_TEMPLATE_PATHS
      See Also:
    • servletContext

      protected javax.servlet.ServletContext servletContext
    • siteNameMacroName

      protected String siteNameMacroName
    • storeType

      protected String storeType
    • rootFolderPath

      protected String rootFolderPath
    • staticAssetsPath

      protected String staticAssetsPath
    • templatesPath

      protected String templatesPath
    • initScriptPath

      protected String initScriptPath
    • restScriptsPath

      protected String restScriptsPath
    • controllerScriptsPath

      protected String controllerScriptsPath
    • configPaths

      protected String[] configPaths
    • applicationContextPaths

      protected String[] applicationContextPaths
    • urlRewriteConfPaths

      protected String[] urlRewriteConfPaths
    • proxyConfigPaths

      protected String[] proxyConfigPaths
    • translationConfigPaths

      protected String[] translationConfigPaths
    • groovyClassesPath

      protected String groovyClassesPath
    • groovyGlobalVars

      protected Map<String,Object> 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

      protected MacroResolver macroResolver
    • globalApplicationContext

      protected org.springframework.context.ApplicationContext globalApplicationContext
    • jobResolvers

      protected List<ScriptJobResolver> jobResolvers
    • jobThreadPoolExecutor

      protected Executor jobThreadPoolExecutor
    • graphQLFactory

      protected GraphQLFactory graphQLFactory
    • cacheWarmUpEnabled

      protected boolean cacheWarmUpEnabled
    • cacheWarmer

      protected SiteCacheWarmer cacheWarmer
    • initTimeout

      protected long initTimeout
    • configurationReader

      protected org.craftercms.commons.config.EncryptionAwareConfigurationReader configurationReader
    • disableVariableRestrictions

      protected boolean disableVariableRestrictions
    • defaultPublicBeans

      protected String[] defaultPublicBeans
    • shutdownTimeout

      protected long shutdownTimeout
    • publishingTargetResolver

      protected org.craftercms.commons.config.PublishingTargetResolver publishingTargetResolver
    • publishingTargetMacroName

      protected String publishingTargetMacroName
    • enableScriptSandbox

      protected boolean enableScriptSandbox
    • enableSandboxBlacklist

      protected boolean enableSandboxBlacklist
    • sandboxBlacklist

      protected String sandboxBlacklist
    • enableExpressions

      protected boolean enableExpressions
    • enableTranslation

      protected boolean enableTranslation
  • Constructor Details

    • SiteContextFactory

      public SiteContextFactory()
  • Method Details

    • setServletContext

      public void setServletContext(javax.servlet.ServletContext servletContext)
      Specified by:
      setServletContext in interface org.springframework.web.context.ServletContextAware
    • setSiteNameMacroName

      public void setSiteNameMacroName(String siteNameMacroName)
    • setStoreType

      public void setStoreType(String storeType)
    • setRootFolderPath

      public void setRootFolderPath(String rootFolderPath)
    • setStaticAssetsPath

      public void setStaticAssetsPath(String staticAssetsPath)
    • setTemplatesPath

      public void setTemplatesPath(String templatesPath)
    • setInitScriptPath

      public void setInitScriptPath(String initScriptPath)
    • setRestScriptsPath

      public void setRestScriptsPath(String restScriptsPath)
    • setControllerScriptsPath

      public void setControllerScriptsPath(String controllerScriptsPath)
    • setConfigPaths

      public void setConfigPaths(String[] configPaths)
    • setApplicationContextPaths

      public void setApplicationContextPaths(String[] applicationContextPaths)
    • setUrlRewriteConfPaths

      public void setUrlRewriteConfPaths(String[] urlRewriteConfPaths)
    • setProxyConfigPaths

      public void setProxyConfigPaths(String[] proxyConfigPaths)
    • setTranslationConfigPaths

      public void setTranslationConfigPaths(String[] translationConfigPaths)
    • setGroovyClassesPath

      public void setGroovyClassesPath(String groovyClassesPath)
    • setGroovyGlobalVars

      public void setGroovyGlobalVars(Map<String,Object> groovyGlobalVars)
    • setMergingOn

      public void setMergingOn(boolean mergingOn)
    • setCacheOn

      public void setCacheOn(boolean cacheOn)
    • setMaxAllowedItemsInCache

      public void setMaxAllowedItemsInCache(int maxAllowedItemsInCache)
    • setIgnoreHiddenFiles

      public void setIgnoreHiddenFiles(boolean ignoreHiddenFiles)
    • setFreeMarkerConfigFactory

      public void setFreeMarkerConfigFactory(org.springframework.beans.factory.ObjectFactory<org.springframework.web.servlet.view.freemarker.FreeMarkerConfig> freeMarkerConfigFactory)
    • setUrlTransformationEngine

      public void setUrlTransformationEngine(org.craftercms.core.url.UrlTransformationEngine urlTransformationEngine)
    • setStoreService

      public void setStoreService(org.craftercms.core.service.ContentStoreService storeService)
    • setCacheTemplate

      public void setCacheTemplate(org.craftercms.core.util.cache.CacheTemplate cacheTemplate)
    • setMacroResolver

      public void setMacroResolver(MacroResolver macroResolver)
    • setJobResolvers

      public void setJobResolvers(List<ScriptJobResolver> jobResolvers)
    • setJobThreadPoolExecutor

      public void setJobThreadPoolExecutor(Executor jobThreadPoolExecutor)
    • setGraphQLFactory

      public void setGraphQLFactory(GraphQLFactory graphQLFactory)
    • setCacheWarmUpEnabled

      public void setCacheWarmUpEnabled(boolean cacheWarmUpEnabled)
    • setCacheWarmer

      public void setCacheWarmer(SiteCacheWarmer cacheWarmer)
    • setInitTimeout

      public void setInitTimeout(long initTimeout)
    • setConfigurationReader

      public void setConfigurationReader(org.craftercms.commons.config.EncryptionAwareConfigurationReader configurationReader)
    • setDisableVariableRestrictions

      public void setDisableVariableRestrictions(boolean disableVariableRestrictions)
    • setDefaultPublicBeans

      public void setDefaultPublicBeans(String[] defaultPublicBeans)
    • 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

      public void setSandboxBlacklist(String sandboxBlacklist)
    • 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 interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • createContext

      public SiteContext createContext(String siteName)
    • 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

      protected URLClassLoader getClassLoader(SiteContext siteContext)
    • 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

      protected ScriptFactory getScriptFactory(SiteContext siteContext, URLClassLoader classLoader)
    • scheduleJobs

      protected org.quartz.Scheduler scheduleJobs(SiteContext siteContext)