use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.
the class RestDeleteApplication method call.
public static String call(PageContext pc, String dirPath, String strWebAdminPassword) throws PageException {
Password webAdminPassword = CacheUtil.getPassword(pc, strWebAdminPassword, false);
Resource dir = RestDeleteApplication.toResource(pc, dirPath);
ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
try {
XMLConfigAdmin admin = XMLConfigAdmin.newInstance((ConfigWebImpl) pc.getConfig(), webAdminPassword);
Mapping[] mappings = config.getRestMappings();
Mapping mapping;
for (int i = 0; i < mappings.length; i++) {
mapping = mappings[i];
if (RestUtil.isMatch(pc, mapping, dir)) {
admin.removeRestMapping(mapping.getVirtual());
admin.storeAndReload();
}
}
} catch (Exception e) {
throw Caster.toPageException(e);
}
return null;
}
use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.
the class Admin method doGetLoggedDebugData.
private void doGetLoggedDebugData() throws PageException {
if (config instanceof ConfigServer)
return;
ConfigWebImpl cw = (ConfigWebImpl) config;
pageContext.setVariable(getString("admin", action, "returnVariable"), cw.getDebuggerPool().getData(pageContext));
}
use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.
the class CFTag method cfcStartTag.
// CFC
private int cfcStartTag() throws PageException {
callerScope.initialize(pageContext);
try {
cfc = ComponentLoader.loadComponent(pageContext, source.getPageSource(), ResourceUtil.removeExtension(source.getFilename(), source.getFilename()), false, true);
} catch (PageException e) {
Mapping m = source.getPageSource().getMapping();
ConfigWebImpl c = (ConfigWebImpl) pageContext.getConfig();
if (m == c.getTagMapping())
m = c.getServerTagMapping();
else
m = null;
// is te page source from a tag mapping, so perhaps it was moved from server to web context
if (m != null) {
PageSource ps = m.getPageSource(source.getFilename());
try {
cfc = ComponentLoader.loadComponent(pageContext, ps, ResourceUtil.removeExtension(source.getFilename(), source.getFilename()), false, true);
} catch (PageException e1) {
throw e;
}
} else
throw e;
}
validateAttributes(cfc, attributesScope, StringUtil.ucFirst(ListUtil.last(source.getPageSource().getComponentName(), '.')));
boolean exeBody = false;
try {
Object rtn = Boolean.TRUE;
if (cfc.contains(pageContext, KeyConstants._init)) {
Tag parent = getParent();
while (parent != null && !(parent instanceof CFTag && ((CFTag) parent).isCFCBasedCustomTag())) {
parent = parent.getParent();
}
Struct args = new StructImpl(Struct.TYPE_LINKED);
args.set(KeyConstants._HASENDTAG, Caster.toBoolean(hasBody));
if (parent instanceof CFTag) {
args.set(PARENT, ((CFTag) parent).getComponent());
}
rtn = cfc.callWithNamedValues(pageContext, KeyConstants._init, args);
}
if (cfc.contains(pageContext, ON_START_TAG)) {
Struct args = new StructImpl();
args.set(KeyConstants._ATTRIBUTES, attributesScope);
setCaller(pageContext, args);
rtn = cfc.callWithNamedValues(pageContext, ON_START_TAG, args);
}
exeBody = Caster.toBooleanValue(rtn, true);
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
_doCFCCatch(t, "start", true);
}
return exeBody ? EVAL_BODY_BUFFERED : SKIP_BODY;
}
use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.
the class ClassUtilImpl method loadBIF.
@Override
public BIF loadBIF(PageContext pc, String name) throws InstantiationException, IllegalAccessException {
// first of all we chek if itis a class
Class<?> res = lucee.commons.lang.ClassUtil.loadClass(name, null);
if (res != null) {
if (Reflector.isInstaneOf(res, BIF.class)) {
return (BIF) res.newInstance();
}
return new BIFProxy(res);
}
FunctionLib[] flds = ((ConfigWebImpl) pc.getConfig()).getFLDs(pc.getCurrentTemplateDialect());
FunctionLibFunction flf;
for (int i = 0; i < flds.length; i++) {
flf = flds[i].getFunction(name);
if (flf != null)
return flf.getBIF();
}
return null;
}
use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.
the class DBUtilImpl method releaseDatasourceConnection.
public void releaseDatasourceConnection(Config config, DatasourceConnection dc) {
ConfigImpl ci = (ConfigWebImpl) ThreadLocalPageContext.getConfig(config);
ci.getDatasourceConnectionPool().releaseDatasourceConnection(dc);
}
Aggregations