protected FactoryConfiguration getConfiguration()

in velocity-tools-view/src/main/java/org/apache/velocity/tools/view/VelocityView.java [586:623]


    protected FactoryConfiguration getConfiguration(String path, boolean required)
    {
        if (getLog().isTraceEnabled())
        {
            getLog().trace("Searching for configuration at: {}", path);
        }

        FactoryConfiguration config = null;
        try
        {
            config = ServletUtils.getConfiguration(path, this.servletContext);
            if (config == null)
            {
                String msg = "Did not find resource at: "+path;
                if (required)
                {
                    getLog().error(msg);
                    throw new ResourceNotFoundException(msg);
                }
                else
                {
                    getLog().debug(msg);
                }
            }
        }
        catch (ResourceNotFoundException rnfe)
        {
            // no need to re-log this
            throw rnfe;
        }
        catch (RuntimeException re)
        {
            // even if the file is not required, an error inside it is considered fatal
            getLog().error(re.getMessage(), re);
            throw re;
        }
        return config;
    }