Search in sources :

Example 1 with Config

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

the class ReqRspUtil method _getCharacterEncoding.

private static Charset _getCharacterEncoding(PageContext pc, String ce) {
    if (!StringUtil.isEmpty(ce, true)) {
        Charset c = CharsetUtil.toCharset(ce, null);
        if (c != null)
            return c;
    }
    pc = ThreadLocalPageContext.get(pc);
    if (pc != null)
        return pc.getWebCharset();
    Config config = ThreadLocalPageContext.getConfig(pc);
    return config.getWebCharset();
}
Also used : Config(lucee.runtime.config.Config) Charset(java.nio.charset.Charset)

Example 2 with Config

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

the class OSGiUtil method log.

private static void log(int level, String msg) {
    try {
        Config config = ThreadLocalPageContext.getConfig();
        Log log = config != null ? config.getLog("application") : null;
        if (log != null)
            log.log(level, "OSGi", msg);
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
        /* this can fail when called from an old loader */
        System.out.println(msg);
    }
}
Also used : Log(lucee.commons.io.log.Log) Config(lucee.runtime.config.Config)

Example 3 with Config

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

the class ThreadLocalPageContext method getTimeZone.

public static TimeZone getTimeZone(PageContext pc) {
    // pc
    pc = get(pc);
    if (pc != null) {
        if (pc.getTimeZone() != null)
            return pc.getTimeZone();
        return DEFAULT_TIMEZONE;
    }
    // config
    Config config = getConfig((Config) null);
    if (config != null && config.getTimeZone() != null) {
        return config.getTimeZone();
    }
    return DEFAULT_TIMEZONE;
}
Also used : Config(lucee.runtime.config.Config)

Example 4 with Config

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

the class ThreadLocalPageContext method getLocale.

public static Locale getLocale(PageContext pc) {
    // pc
    pc = get(pc);
    if (pc != null) {
        if (pc.getLocale() != null)
            return pc.getLocale();
        return DEFAULT_LOCALE;
    }
    // config
    Config config = getConfig((Config) null);
    if (config != null && config.getLocale() != null) {
        return config.getLocale();
    }
    return DEFAULT_LOCALE;
}
Also used : Config(lucee.runtime.config.Config)

Example 5 with Config

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

the class PageExceptionImpl method toString.

public static String toString(PageContext pc, StackTraceElement trace) {
    String path = null;
    if (trace.getFileName() == null || trace.getFileName().endsWith(".java"))
        return trace.toString();
    Config config = ThreadLocalPageContext.getConfig(pc);
    if (config != null) {
        Resource res = pc.getConfig().getResource(trace.getFileName());
        if (res.exists())
            path = trace.getFileName();
        // get path from source
        if (path == null) {
            SourceInfo si = MappingUtil.getMatch(pc, trace);
            if (si != null) {
                if (si.absolutePath(pc) != null) {
                    res = pc.getConfig().getResource(si.absolutePath(pc));
                    if (res.exists())
                        path = si.absolutePath(pc);
                }
                if (path == null && si.relativePath != null)
                    path = si.relativePath;
            }
            if (path == null)
                path = trace.getFileName();
        }
    }
    return trace.getClassName() + "." + trace.getMethodName() + (trace.isNativeMethod() ? "(Native Method)" : (path != null && trace.getLineNumber() >= 0 ? "(" + path + ":" + trace.getLineNumber() + ")" : (path != null ? "(" + path + ")" : "(Unknown Source)")));
}
Also used : SourceInfo(lucee.transformer.bytecode.util.SourceNameClassVisitor.SourceInfo) Config(lucee.runtime.config.Config) Resource(lucee.commons.io.res.Resource)

Aggregations

Config (lucee.runtime.config.Config)25 ConfigWeb (lucee.runtime.config.ConfigWeb)4 ConfigImpl (lucee.runtime.config.ConfigImpl)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 Cache (lucee.commons.io.cache.Cache)2 Log (lucee.commons.io.log.Log)2 Resource (lucee.commons.io.res.Resource)2 CFMLFactory (lucee.runtime.CFMLFactory)2 PageContext (lucee.runtime.PageContext)2 ThreadLocalPageContext (lucee.runtime.engine.ThreadLocalPageContext)2 File (java.io.File)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 Charset (java.nio.charset.Charset)1 SimpleDateFormat (java.text.SimpleDateFormat)1 HashMap (java.util.HashMap)1 ServletConfig (javax.servlet.ServletConfig)1 CacheException (lucee.commons.io.cache.exp.CacheException)1 ResourceProvider (lucee.commons.io.res.ResourceProvider)1 ExtensionResourceFilter (lucee.commons.io.res.filter.ExtensionResourceFilter)1