protected void configure()

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


    protected void configure(final JeeConfig config, final VelocityEngine velocity)
    {
        // first get the default properties from the classpath, and bail if we don't find them
        Properties defaultProperties = getProperties(DEFAULT_PROPERTIES_PATH, true);
        velocity.setProperties(defaultProperties);

        // check for application-wide user props in the context init params
        String appPropsPath = servletContext.getInitParameter(PROPERTIES_KEY);
        if (appPropsPath != null)
        {
            Properties appProperties = getProperties(appPropsPath, true);
            getLog().debug("Configuring Velocity with properties at: {}", appPropsPath);
            velocity.setProperties(appProperties);
        }

        // check for a custom location for servlet-wide user props
        String servletPropsPath = config.getInitParameter(PROPERTIES_KEY);
        if (servletPropsPath != null && (appPropsPath == null || !appPropsPath.equals(servletPropsPath)))
        {
            boolean isInWebInf = servletPropsPath.startsWith("/WEB-INF") || servletPropsPath.startsWith("WEB-INF");
            Properties servletProperties = getProperties(servletPropsPath, true);
            getLog().debug("Configuring Velocity with properties at: {}", servletPropsPath);
            velocity.setProperties(servletProperties);
        }

        // check for servlet-wide user props in the config init params at the
        // conventional location, and be silent if they're missing
        if (appPropsPath == null && servletPropsPath == null)
        {
            Properties appProperties = getProperties(USER_PROPERTIES_PATH, false);
            if (appProperties != null)
            {
                getLog().debug("Configuring Velocity with properties at: {}", appPropsPath);
                velocity.setProperties(appProperties);
            }
        }

        /* now that velocity engine is initialized, re-initialize our logger
           so that it takes potentially provided configuration attributes
           into account
         */
        initLog();
    }