Search in sources :

Example 41 with ConfigWebImpl

use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.

the class SystemCacheClear method functionCache.

private static void functionCache(PageContext pc) {
    ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
    config.clearFunctionCache();
    PagePoolClear.clear(config.getServerFunctionMapping());
    PagePoolClear.clear(config.getFunctionMapping());
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl)

Example 42 with ConfigWebImpl

use of lucee.runtime.config.ConfigWebImpl in project Lucee by lucee.

the class RestInitApplication method _call.

public static String _call(PageContext pc, String dirPath, String serviceMapping, Boolean defaultMapping, String webAdminPassword) throws PageException {
    if (StringUtil.isEmpty(serviceMapping, true)) {
        serviceMapping = pc.getApplicationContext().getName();
    }
    Resource dir = RestDeleteApplication.toResource(pc, dirPath);
    ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
    Mapping[] mappings = config.getRestMappings();
    Mapping mapping;
    // id is mapping name
    String virtual = serviceMapping.trim();
    if (!virtual.startsWith("/"))
        virtual = "/" + virtual;
    if (!virtual.endsWith("/"))
        virtual += "/";
    boolean hasResetted = false;
    for (int i = 0; i < mappings.length; i++) {
        mapping = mappings[i];
        if (mapping.getVirtualWithSlash().equals(virtual)) {
            // directory has changed
            if (!RestUtil.isMatch(pc, mapping, dir) || (defaultMapping != null && mapping.isDefault() != defaultMapping.booleanValue())) {
                update(pc, dir, virtual, CacheUtil.getPassword(pc, webAdminPassword, false), defaultMapping == null ? mapping.isDefault() : defaultMapping.booleanValue());
            }
            mapping.reset(pc);
            hasResetted = true;
        }
    }
    if (!hasResetted) {
        update(pc, dir, virtual, CacheUtil.getPassword(pc, webAdminPassword, false), defaultMapping == null ? false : defaultMapping.booleanValue());
    }
    return null;
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) Resource(lucee.commons.io.res.Resource) Mapping(lucee.runtime.rest.Mapping)

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