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();
}
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);
}
}
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;
}
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;
}
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)")));
}
Aggregations