Search in sources :

Example 21 with ConfigWebImpl

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;
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) Resource(lucee.commons.io.res.Resource) Mapping(lucee.runtime.rest.Mapping) XMLConfigAdmin(lucee.runtime.config.XMLConfigAdmin) FunctionException(lucee.runtime.exp.FunctionException) PageException(lucee.runtime.exp.PageException) Password(lucee.runtime.config.Password)

Example 22 with ConfigWebImpl

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));
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) ConfigServer(lucee.runtime.config.ConfigServer)

Example 23 with ConfigWebImpl

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;
}
Also used : PageException(lucee.runtime.exp.PageException) ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) StructImpl(lucee.runtime.type.StructImpl) Mapping(lucee.runtime.Mapping) TagLibTag(lucee.transformer.library.tag.TagLibTag) Tag(javax.servlet.jsp.tagext.Tag) AppendixTag(lucee.runtime.ext.tag.AppendixTag) PageSource(lucee.runtime.PageSource) Struct(lucee.runtime.type.Struct)

Example 24 with ConfigWebImpl

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;
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) FunctionLibFunction(lucee.transformer.library.function.FunctionLibFunction) FunctionLib(lucee.transformer.library.function.FunctionLib) BIFProxy(lucee.runtime.functions.BIFProxy) BIF(lucee.runtime.ext.function.BIF)

Example 25 with ConfigWebImpl

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);
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) ConfigImpl(lucee.runtime.config.ConfigImpl)

Aggregations

ConfigWebImpl (lucee.runtime.config.ConfigWebImpl)42 Resource (lucee.commons.io.res.Resource)9 PageContextImpl (lucee.runtime.PageContextImpl)9 Struct (lucee.runtime.type.Struct)9 PageSource (lucee.runtime.PageSource)8 PageException (lucee.runtime.exp.PageException)8 Key (lucee.runtime.type.Collection.Key)8 CFMLFactoryImpl (lucee.runtime.CFMLFactoryImpl)7 Mapping (lucee.runtime.Mapping)7 ConfigServer (lucee.runtime.config.ConfigServer)6 ConfigWeb (lucee.runtime.config.ConfigWeb)5 ApplicationException (lucee.runtime.exp.ApplicationException)5 StructImpl (lucee.runtime.type.StructImpl)5 IOException (java.io.IOException)4 Entry (java.util.Map.Entry)4 ConfigImpl (lucee.runtime.config.ConfigImpl)4 HTTPResource (lucee.commons.io.res.type.http.HTTPResource)3 Page (lucee.runtime.Page)3 PageContext (lucee.runtime.PageContext)3 ExpressionException (lucee.runtime.exp.ExpressionException)3