use of lucee.runtime.PageContext in project Lucee by lucee.
the class ScriptEngineImpl method get.
@Override
public Object get(String key) {
PageContext oldPC = ThreadLocalPageContext.get();
PageContext pc = getPageContext(getContext());
try {
return pc.undefinedScope().get(KeyImpl.init(key), null);
} finally {
releasePageContext(pc, oldPC);
}
}
use of lucee.runtime.PageContext in project Lucee by lucee.
the class CacheResourceProvider method getCache.
public Cache getCache() {
PageContext pc = ThreadLocalPageContext.get();
Cache c = CacheUtil.getDefault(pc, Config.CACHE_TYPE_RESOURCE, null);
if (c == null) {
// CFMLEngineImpl e=null;
if (defaultCache == null) {
defaultCache = new RamCache().init(0, 0, RamCache.DEFAULT_CONTROL_INTERVAL);
}
c = defaultCache;
}
if (!inits.contains(c.hashCode())) {
String k = toKey("null", "");
try {
if (!c.contains(k)) {
CacheResourceCore value = new CacheResourceCore(CacheResourceCore.TYPE_DIRECTORY, null, "");
c.put(k, value, Constants.LONG_ZERO, Constants.LONG_ZERO);
}
} catch (IOException e) {
// simply ignore
}
inits.add(c.hashCode());
}
return c;
}
use of lucee.runtime.PageContext in project Lucee by lucee.
the class ThreadTag method getThreadScope.
public static Threads getThreadScope(PageContext pc, Key name, int level) {
Threads t = null;
// current
if ((level & LEVEL_CURRENT) > 0) {
t = pc.getThreadScope(name);
if (t != null)
return t;
}
// parent
if ((level & LEVEL_PARENTS) > 0) {
PageContext parent = pc.getParentPageContext();
while (parent != null) {
t = parent.getThreadScope(name);
if (t != null)
return t;
parent = parent.getParentPageContext();
}
}
// children
if ((level & LEVEL_KIDS) > 0 && pc.hasFamily()) {
t = getKidsThreadScope(((PageContextImpl) pc).getChildPageContexts(), name);
if (t != null)
return t;
}
return t;
}
use of lucee.runtime.PageContext in project Lucee by lucee.
the class ThreadTag method getKidsThreadScope.
private static Threads getKidsThreadScope(List<PageContext> pageContexts, Key name) {
if (pageContexts == null || pageContexts.isEmpty())
return null;
Threads t;
Iterator<PageContext> it = pageContexts.iterator();
PageContext pc;
while (it.hasNext()) {
pc = it.next();
t = pc.getThreadScope(name);
if (t != null)
return t;
t = getKidsThreadScope(((PageContextImpl) pc).getChildPageContexts(), name);
return t;
}
return null;
}
use of lucee.runtime.PageContext in project Lucee by lucee.
the class ThreadTag method getKidsThreadScopeNames.
private static void getKidsThreadScopeNames(List<PageContext> pageContexts, java.util.Collection<String> result, int level) {
if (pageContexts == null || pageContexts.isEmpty())
return;
String[] names = null;
Iterator<PageContext> it = pageContexts.iterator();
PageContext pc;
while (it.hasNext()) {
pc = it.next();
names = pc.getThreadScopeNames();
if (names != null)
for (int i = 0; i < names.length; i++) {
result.add(names[i]);
}
getKidsThreadScopeNames(((PageContextImpl) pc).getChildPageContexts(), result, level + 1);
}
}
Aggregations