本文整理了Java中org.apache.wicket.ThreadContext.exists()
方法的一些代码示例,展示了ThreadContext.exists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadContext.exists()
方法的具体详情如下:
包路径:org.apache.wicket.ThreadContext
类名称:ThreadContext
方法名:exists
[英]Checks if ThreadContext exists for the current thread
[中]检查当前线程是否存在ThreadContext
代码示例来源:origin: apache/wicket
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
boolean existed = ThreadContext.exists();
if (existed == false)
{
ThreadContext.setApplication(application);
}
try
{
return method.invoke(o, args);
}
finally
{
if (existed == false)
{
ThreadContext.detach();
}
}
}
});
代码示例来源:origin: ru.ydn.wicket.wicket-orientdb/wicket-orientdb
protected CookieManager getPersonalCookieManager()
{
try
{
if(!ThreadContext.exists() || RequestCycle.get()==null) return defaultManager;
OrientDbWebSession session = OrientDbWebSession.get();
session.bind();
String id = session.getId();
if(session.isSignedIn()) id=session.getUsername()+'-'+id;
return cache.get(id, new Callable<CookieManager>() {
@Override
public CookieManager call() throws Exception {
return new CookieManager();
}
});
} catch (ExecutionException e)
{
throw new IllegalStateException("Cookie Manager should be always calculated");
}
}
代码示例来源:origin: OrienteerBAP/wicket-orientdb
protected CookieManager getPersonalCookieManager()
{
try
{
if(!ThreadContext.exists() || RequestCycle.get()==null) return defaultManager;
OrientDbWebSession session = OrientDbWebSession.get();
session.bind();
String id = session.getId();
if(session.isSignedIn()) id=session.getUsername()+'-'+id;
return cache.get(id, new Callable<CookieManager>() {
@Override
public CookieManager call() throws Exception {
return new CookieManager();
}
});
} catch (ExecutionException e)
{
throw new IllegalStateException("Cookie Manager should be always calculated");
}
}
代码示例来源:origin: at.molindo/molindo-wicket-utils
Session oldSession = ThreadContext.exists() ? ThreadContext.getSession() : null;
ThreadContext oldContext = ThreadContext.detach();
内容来源于网络,如有侵权,请联系作者删除!