public static InitFile createInitFile(PageContext pageContext, boolean isweb, String filename) { ConfigWebImpl config = (ConfigWebImpl) pageContext.getConfig(); Mapping mapping = isweb ? config.getTagMapping() : config.getServerTagMapping(); return new InitFile( mapping.getPageSource(filename), filename, filename.endsWith('.' + config.getCFCExtension())); }
public static synchronized UDF loadUDF( PageContext pc, String filename, Collection.Key name, boolean isweb) throws PageException { ConfigWebImpl config = (ConfigWebImpl) pc.getConfig(); String key = isweb ? name.getString() + config.getId() : name.getString(); UDF udf = config.getFromFunctionCache(key); if (udf != null) return udf; Mapping mapping = isweb ? config.getFunctionMapping() : config.getServerFunctionMapping(); PageSourceImpl ps = (PageSourceImpl) mapping.getPageSource(filename); Page p = ps.loadPage(pc, pc.getConfig()); // execute page Variables old = pc.variablesScope(); pc.setVariablesScope(VAR); boolean wasSilent = pc.setSilent(); try { p.call(pc); Object o = pc.variablesScope().get(name, null); if (o instanceof UDF) { udf = (UDF) o; config.putToFunctionCache(key, udf); return udf; } throw new ExpressionException( "there is no Function defined with name [" + name + "] in template [" + mapping.getStrPhysical() + File.separator + filename + "]"); } catch (Throwable t) { throw Caster.toPageException(t); } finally { pc.setVariablesScope(old); if (!wasSilent) pc.unsetSilent(); } }
private static void functionCache(PageContext pc) { ConfigWebImpl config = (ConfigWebImpl) pc.getConfig(); config.clearFunctionCache(); PagePoolClear.clear(config.getServerFunctionMapping()); PagePoolClear.clear(config.getFunctionMapping()); }
private static void tagCache(PageContext pc) { ConfigWebImpl config = (ConfigWebImpl) pc.getConfig(); PagePoolClear.clear(config.getServerTagMapping()); PagePoolClear.clear(config.getTagMapping()); }