类 VelocityEngineFactory

    • 字段概要

      字段 
      修饰符和类型字段说明
      protected Loglogger
      已过时。
       
    • 方法概要

      所有方法 实例方法 具体方法 已过时的方法 
      修饰符和类型方法说明
      org.apache.velocity.app.VelocityEnginecreateVelocityEngine()
      已过时。
      Prepare the VelocityEngine instance and return it.
      protected ResourceLoadergetResourceLoader()
      已过时。
      Return the Spring ResourceLoader to use for loading Velocity template files.
      protected voidinitSpringResourceLoader​(org.apache.velocity.app.VelocityEngine velocityEngine, String resourceLoaderPath)
      已过时。
      Initialize a SpringResourceLoader for the given VelocityEngine.
      protected voidinitVelocityResourceLoader​(org.apache.velocity.app.VelocityEngine velocityEngine, String resourceLoaderPath)
      已过时。
      Initialize a Velocity resource loader for the given VelocityEngine: either a standard Velocity FileResourceLoader or a SpringResourceLoader.
      protected booleanisPreferFileSystemAccess()
      已过时。
      Return whether to prefer file system access for template loading.
      protected org.apache.velocity.app.VelocityEnginenewVelocityEngine()
      已过时。
      Return a new VelocityEngine.
      protected voidpostProcessVelocityEngine​(org.apache.velocity.app.VelocityEngine velocityEngine)
      已过时。
      To be implemented by subclasses that want to perform custom post-processing of the VelocityEngine after this FactoryBean performed its default configuration (but before VelocityEngine.init).
      voidsetConfigLocation​(Resource configLocation)
      已过时。
      Set the location of the Velocity config file.
      voidsetOverrideLogging​(boolean overrideLogging)
      已过时。
      Set whether Velocity should log via Commons Logging, i.e. whether Velocity's log system should be set to CommonsLogLogChute.
      voidsetPreferFileSystemAccess​(boolean preferFileSystemAccess)
      已过时。
      Set whether to prefer file system access for template loading.
      voidsetResourceLoader​(ResourceLoader resourceLoader)
      已过时。
      Set the Spring ResourceLoader to use for loading Velocity template files.
      voidsetResourceLoaderPath​(String resourceLoaderPath)
      已过时。
      Set the Velocity resource loader path via a Spring resource location.
      voidsetVelocityProperties​(Properties velocityProperties)
      已过时。
      Set Velocity properties, like "file.resource.loader.path".
      voidsetVelocityPropertiesMap​(Map<String,​Object> velocityPropertiesMap)
      已过时。
      Set Velocity properties as Map, to allow for non-String values like "ds.resource.loader.instance".
    • 字段详细资料

      • logger

        protected final Log logger
        已过时。
    • 方法详细资料

      • setResourceLoaderPath

        public void setResourceLoaderPath​(String resourceLoaderPath)
        已过时。
        Set the Velocity resource loader path via a Spring resource location. Accepts multiple locations in Velocity's comma-separated path style.

        When populated via a String, standard URLs like "file:" and "classpath:" pseudo URLs are supported, as understood by ResourceLoader. Allows for relative paths when running in an ApplicationContext.

        Will define a path for the default Velocity resource loader with the name "file". If the specified resource cannot be resolved to a java.io.File, a generic SpringResourceLoader will be used under the name "spring", without modification detection.

        Note that resource caching will be enabled in any case. With the file resource loader, the last-modified timestamp will be checked on access to detect changes. With SpringResourceLoader, the resource will be cached forever (for example for class path resources).

        To specify a modification check interval for files, use Velocity's standard "file.resource.loader.modificationCheckInterval" property. By default, the file timestamp is checked on every access (which is surprisingly fast). Of course, this just applies when loading resources from the file system.

        To enforce the use of SpringResourceLoader, i.e. to not resolve a path as file system resource in any case, turn off the "preferFileSystemAccess" flag. See the latter's javadoc for details.

        另请参阅:
        setResourceLoader(org.springframework.core.io.ResourceLoader), setVelocityProperties(java.util.Properties), setPreferFileSystemAccess(boolean), SpringResourceLoader, FileResourceLoader
      • setPreferFileSystemAccess

        public void setPreferFileSystemAccess​(boolean preferFileSystemAccess)
        已过时。
        Set whether to prefer file system access for template loading. File system access enables hot detection of template changes.

        If this is enabled, VelocityEngineFactory will try to resolve the specified "resourceLoaderPath" as file system resource (which will work for expanded class path resources and ServletContext resources too).

        Default is "true". Turn this off to always load via SpringResourceLoader (i.e. as stream, without hot detection of template changes), which might be necessary if some of your templates reside in an expanded classes directory while others reside in jar files.

        另请参阅:
        setResourceLoaderPath(java.lang.String)
      • isPreferFileSystemAccess

        protected boolean isPreferFileSystemAccess()
        已过时。
        Return whether to prefer file system access for template loading.
      • setOverrideLogging

        public void setOverrideLogging​(boolean overrideLogging)
        已过时。
        Set whether Velocity should log via Commons Logging, i.e. whether Velocity's log system should be set to CommonsLogLogChute. Default is "true".
      • createVelocityEngine

        public org.apache.velocity.app.VelocityEngine createVelocityEngine()
                                                                    throws IOException,
                                                                           org.apache.velocity.exception.VelocityException
        已过时。
        Prepare the VelocityEngine instance and return it.
        返回:
        the VelocityEngine instance
        抛出:
        IOException - if the config file wasn't found
        org.apache.velocity.exception.VelocityException - on Velocity initialization failure
      • newVelocityEngine

        protected org.apache.velocity.app.VelocityEngine newVelocityEngine()
                                                                    throws IOException,
                                                                           org.apache.velocity.exception.VelocityException
        已过时。
        Return a new VelocityEngine. Subclasses can override this for custom initialization, or for using a mock object for testing.

        Called by createVelocityEngine().

        返回:
        the VelocityEngine instance
        抛出:
        IOException - if a config file wasn't found
        org.apache.velocity.exception.VelocityException - on Velocity initialization failure
        另请参阅:
        createVelocityEngine()
      • postProcessVelocityEngine

        protected void postProcessVelocityEngine​(org.apache.velocity.app.VelocityEngine velocityEngine)
                                          throws IOException,
                                                 org.apache.velocity.exception.VelocityException
        已过时。
        To be implemented by subclasses that want to perform custom post-processing of the VelocityEngine after this FactoryBean performed its default configuration (but before VelocityEngine.init).

        Called by createVelocityEngine().

        参数:
        velocityEngine - the current VelocityEngine
        抛出:
        IOException - if a config file wasn't found
        org.apache.velocity.exception.VelocityException - on Velocity initialization failure
        另请参阅:
        createVelocityEngine(), VelocityEngine.init()