protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext) { // TODO: Remove heavy coupling on horrible SM2 Factory Factory factory = Factory.getInstance(new Config(filterConfig)); factory.refresh(); return new DecoratorMapper2DecoratorSelector(factory.getDecoratorMapper()); }
public boolean handles(String contentType) { return factory.shouldParsePage(contentType); }
private DecoratorMapper getDecoratorMapper() { Factory factory = Factory.getInstance(new Config(getServletConfig())); return factory.getDecoratorMapper(); }
protected ContentProcessor initContentProcessor(SiteMeshWebAppContext webAppContext) { // TODO: Remove heavy coupling on horrible SM2 Factory Factory factory = Factory.getInstance(new Config(filterConfig)); factory.refresh(); return new PageParser2ContentProcessor(factory); }
private PageParserSelector getParserSelector() { return Factory.getInstance(config); }
/** * Returns a Sitemesh Decorator object with the <code>decoratorName</code> specified. * * @param request * @param decoratorName * @return */ protected Decorator getDecorator(HttpServletRequest request, String decoratorName) { return getSitemeshFactory().getDecoratorMapper().getNamedDecorator(request, decoratorName); }
/** * Entry-point for obtaining singleton instance of Factory. The default factory class * that will be instantiated can be overridden with the environment * entry <code>sitemesh.factory</code>. */ public static Factory getInstance(Config config) { Factory instance = (Factory)config.getServletContext().getAttribute(SITEMESH_FACTORY); if (instance == null) { String factoryClass = getEnvEntry("sitemesh.factory", "com.opensymphony.module.sitemesh.factory.DefaultFactory"); try { Class cls = ClassLoaderUtil.loadClass(factoryClass, config.getClass()); Constructor con = cls.getConstructor(new Class[] { Config.class }); instance = (Factory)con.newInstance(new Config[] { config }); config.getServletContext().setAttribute(SITEMESH_FACTORY, instance); } catch (InvocationTargetException e) { throw new FactoryException("Cannot construct Factory : " + factoryClass, e.getTargetException()); } catch (Exception e) { throw new FactoryException("Cannot construct Factory : " + factoryClass, e); } } instance.refresh(); return instance; }
/** * Returns a Sitemesh PageParser object with the <code>contentType</code> * specified, which by default is "text/html". * * @param contentType * @return */ protected PageParser getPageParser(String contentType) { Factory factory = getSitemeshFactory(); return factory.getPageParser(contentType == null ? "text/html" : contentType); }
public boolean handles(SiteMeshContext context) { SiteMeshWebAppContext webAppContext = (SiteMeshWebAppContext) context; return !factory.isPathExcluded(extractRequestPath(webAppContext.getRequest())); }
private DecoratorMapper getDecoratorMapper() { Factory factory = Factory.getInstance(new Config(getServletConfig())); DecoratorMapper decoratorMapper = factory.getDecoratorMapper(); return decoratorMapper; } }
/** * Returns a Sitemesh Factory object. * @return */ protected Factory getSitemeshFactory() { ServletConfig servletConfig = JspSupportServlet.jspSupportServlet.getServletConfig(); Config config = new Config(servletConfig); Factory factory = Factory.getInstance(config); return factory; }
public Content build(char[] data, SiteMeshContext context) throws IOException { HttpContentType httpContentType = new HttpContentType(context.getContentType()); PageParser pageParser = factory.getPageParser(httpContentType.getType()); Page page = pageParser.parse(data); return new HTMLPage2Content((HTMLPage) page); } }
protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext) { Factory factory = Factory.getInstance(new Config(filterConfig)); factory.refresh(); return new FreemarkerMapper2DecoratorSelector(factory.getDecoratorMapper()); } }
public int doStartTag() { if (config == null) { // set context if not already set config = new Config(pageContext.getServletConfig()); factory = Factory.getInstance(config); decoratorMapper = factory.getDecoratorMapper(); } // return page == null ? EVAL_BODY_BUFFERED : SKIP_BODY; return EVAL_BODY_BUFFERED; }
protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext) { // TODO: Remove heavy coupling on horrible SM2 Factory Factory factory = Factory.getInstance(new Config(filterConfig)); factory.refresh(); return new FreemarkerMapper2DecoratorSelector(factory.getDecoratorMapper()); }