Package org.apache.velocity.tools.config

Examples of org.apache.velocity.tools.config.FactoryConfiguration


    }


    protected void configure(final ServletConfig config, final ToolboxFactory factory)
    {
        FactoryConfiguration factoryConfig = new FactoryConfiguration();

        boolean hasOldToolbox = false;
        if (this.deprecationSupportMode)
        {
            FactoryConfiguration oldToolbox = getDeprecatedConfig(config);
            if (oldToolbox != null)
            {
                hasOldToolbox = true;
                factoryConfig.addConfiguration(oldToolbox);
            }
View Full Code Here


    protected FactoryConfiguration getDeprecatedConfig(ServletConfig config)
    {
        // check for deprecated user configuration at the old conventional
        // location.  be silent if missing, log deprecation warning otherwise
        String oldPath = DEPRECATED_USER_TOOLS_PATH;
        FactoryConfiguration toolbox = getConfiguration(oldPath);
        if (toolbox == null)
        {
            // look for an alternate path under the deprecated toolbox key
            oldPath = findInitParameter(DEPRECATED_TOOLS_KEY, config);
            if (oldPath != null)
View Full Code Here

        }

        // this will throw an exception if require is true and there
        // is no tool config at the path.  if require is false, this
        // will return null when there's no tool config at the path
        FactoryConfiguration config = getConfiguration(path, require);
        if (config == null)
        {
            return false;
        }
View Full Code Here

        }
    }

    public void autoConfigure(boolean includeDefaults)
    {
        FactoryConfiguration config =
            ConfigurationUtils.getAutoLoaded(includeDefaults);

        // look for any specified via system property
        FactoryConfiguration sys = ConfigurationUtils.findFromSystemProperty();
        if (sys != null)
        {
            config.addConfiguration(sys);
        }
        configure(config);
View Full Code Here

        this.factory.configure(config);
    }

    public void configure(String path)
    {
        FactoryConfiguration config = findConfig(path);
        if (config != null)
        {
            configure(config);
        }
        else
View Full Code Here

     * {@code org.apache.velocity.tools.cleanConfiguration} init-param to true in
     * either your servlet or servletContext init-params.
     */
    protected void configure(final ServletConfig config, final ToolboxFactory factory)
    {
        FactoryConfiguration factoryConfig = new FactoryConfiguration();

        boolean hasOldToolbox = false;
        if (this.deprecationSupportMode)
        {
            FactoryConfiguration oldToolbox = getDeprecatedConfig(config);
            if (oldToolbox != null)
            {
                hasOldToolbox = true;
                factoryConfig.addConfiguration(oldToolbox);
            }
        }

        // only load the default tools if they have explicitly said to
        // or if they are not using an old toolbox and have said nothing
        String loadDefaults = findInitParameter(LOAD_DEFAULTS_KEY, config);
        if ((!hasOldToolbox && loadDefaults == null) ||
            "true".equalsIgnoreCase(loadDefaults))
        {
            // add all available default tools
            getLog().trace("Loading default tools configuration...");
            factoryConfig.addConfiguration(ConfigurationUtils.getDefaultTools());
        }
        else
        {
            // let the user know that the defaults were suppressed
            getLog().debug("Default tools configuration has been suppressed"
                           + (hasOldToolbox ?
                              " to avoid conflicts with older application's context and toolbox definition."
                              : "."));
        }

        // this gets the auto loaded config from the classpath
        // this doesn't include defaults since they're handled already
        // and it could theoretically pick up an auto-loaded config from the
        // filesystem, but that is highly unlikely to happen in a webapp env
        FactoryConfiguration autoLoaded = ConfigurationUtils.getAutoLoaded(false);
        factoryConfig.addConfiguration(autoLoaded);

        // check for application-wide user config in the context init params
        String appToolsPath = servletContext.getInitParameter(TOOLS_KEY);
        setConfig(factoryConfig, appToolsPath, true);
View Full Code Here

     * (the deprecated default location) and tries to load it if found.
     */
    @Deprecated
    protected FactoryConfiguration getDeprecatedConfig(ServletConfig config)
    {
        FactoryConfiguration toolbox = null;

        // look for specified path under the deprecated toolbox key
        String oldPath = findInitParameter(DEPRECATED_TOOLS_KEY, config);
        if (oldPath != null)
        {
View Full Code Here

        }

        // this will throw an exception if require is true and there
        // is no tool config at the path.  if require is false, this
        // will return null when there's no tool config at the path
        FactoryConfiguration config = getConfiguration(path, require);
        if (config == null)
        {
            return false;
        }
View Full Code Here

    public ToolManager(boolean includeDefaults)
    {
        this.factory = new ToolboxFactory();

        FactoryConfiguration config =
            ConfigurationUtils.getAutoLoaded(includeDefaults);

        // look for any specified via system property
        FactoryConfiguration sys = ConfigurationUtils.findFromSystemProperty();
        if (sys != null)
        {
            config.addConfiguration(sys);
        }
        configure(config);
View Full Code Here

        this.factory.configure(config);
    }

    public void configure(String path)
    {
        FactoryConfiguration config = ConfigurationUtils.find(path);
        if (config != null)
        {
            configure(config);
        }
        else
View Full Code Here

TOP

Related Classes of org.apache.velocity.tools.config.FactoryConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.