Search in sources :

Example 1 with Grails5535Factory

use of org.grails.web.sitemesh.Grails5535Factory in project grails-core by grails.

the class SitemeshLayoutViewResolver method loadSitemeshConfig.

protected Factory loadSitemeshConfig() {
    FilterConfig filterConfig = new FilterConfig() {

        @Override
        public ServletContext getServletContext() {
            return servletContext;
        }

        @Override
        public Enumeration<String> getInitParameterNames() {
            return new Enumeration<String>() {

                @Override
                public boolean hasMoreElements() {
                    return false;
                }

                @Override
                public String nextElement() {
                    throw new NoSuchElementException();
                }
            };
        }

        @Override
        public String getInitParameter(String name) {
            return null;
        }

        @Override
        public String getFilterName() {
            return null;
        }
    };
    Config config = new Config(filterConfig);
    Grails5535Factory sitemeshFactory = new Grails5535Factory(config);
    if (servletContext != null) {
        servletContext.setAttribute(FACTORY_SERVLET_CONTEXT_ATTRIBUTE, sitemeshFactory);
    }
    sitemeshFactory.refresh();
    FactoryHolder.setFactory(sitemeshFactory);
    sitemeshConfigLoaded = true;
    return sitemeshFactory;
}
Also used : Enumeration(java.util.Enumeration) Config(com.opensymphony.module.sitemesh.Config) FilterConfig(javax.servlet.FilterConfig) FilterConfig(javax.servlet.FilterConfig) NoSuchElementException(java.util.NoSuchElementException) Grails5535Factory(org.grails.web.sitemesh.Grails5535Factory)

Aggregations

Config (com.opensymphony.module.sitemesh.Config)1 Enumeration (java.util.Enumeration)1 NoSuchElementException (java.util.NoSuchElementException)1 FilterConfig (javax.servlet.FilterConfig)1 Grails5535Factory (org.grails.web.sitemesh.Grails5535Factory)1