本文整理了Java中org.apache.wicket.ThreadContext.restore()
方法的一些代码示例,展示了ThreadContext.restore()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadContext.restore()
方法的具体详情如下:
包路径:org.apache.wicket.ThreadContext
类名称:ThreadContext
方法名:restore
[英]Restores the context
[中]恢复上下文
代码示例来源:origin: at.molindo/molindo-wicket-utils
/**
* unset request and session to force mocking
*/
public static <V> V withNewRequest(WebApplication webApplication, IMockRequestCallback<V> callback) {
ThreadContext oldContext = ThreadContext.detach();
try {
return withRequest(webApplication, callback);
} finally {
ThreadContext.restore(oldContext);
}
}
代码示例来源:origin: org.apache.wicket/wicket-core
/**
* Get the result from the given supplier inside a bound {@link ThreadContext}.
*
* @param supplier
* supplier
* @return result of {@link Supplier#get()}
*/
private <T> T inThreadContext(Supplier<T> supplier)
{
ThreadContext oldContext = ThreadContext.detach();
try
{
ThreadContext.setApplication(application);
return supplier.get();
}
finally
{
ThreadContext.restore(oldContext);
}
}
代码示例来源:origin: apache/wicket
/**
* Get the result from the given supplier inside a bound {@link ThreadContext}.
*
* @param supplier
* supplier
* @return result of {@link Supplier#get()}
*/
private <T> T inThreadContext(Supplier<T> supplier)
{
ThreadContext oldContext = ThreadContext.detach();
try
{
ThreadContext.setApplication(application);
return supplier.get();
}
finally
{
ThreadContext.restore(oldContext);
}
}
代码示例来源:origin: org.apache.wicket/wicket-atmosphere
/**
* Post an event to a single resource. This will invoke the event handlers on all components on
* the page with the suspended connection. The resulting AJAX update (if any) is pushed to the
* client.
*
* @param event
* @param resource
*/
public void post(Object event, AtmosphereResource resource)
{
ThreadContext oldContext = ThreadContext.get(false);
try
{
postToSingleResource(event, resource);
}
finally
{
ThreadContext.restore(oldContext);
}
}
代码示例来源:origin: org.apache.wicket.experimental.wicket8/wicket-atmosphere
/**
* Post an event to a single resource. This will invoke the event handlers on all components on
* the page with the suspended connection. The resulting AJAX update (if any) is pushed to the
* client.
*
* @param event
* @param resource
*/
public void post(Object event, AtmosphereResource resource)
{
ThreadContext oldContext = ThreadContext.get(false);
try
{
postToSingleResource(event, resource);
}
finally
{
ThreadContext.restore(oldContext);
}
}
代码示例来源:origin: org.apache.wicket.experimental.wicket8/wicket-atmosphere
/**
* Post an event to all pages that have a suspended connection. This will invoke the event
* handlers on components, annotated with {@link Subscribe}. The resulting AJAX updates are
* pushed to the clients.
*
* @param event
*/
public void post(Object event)
{
ThreadContext oldContext = ThreadContext.get(false);
try
{
for (AtmosphereResource resource : ImmutableList.copyOf(getBroadcaster().getAtmosphereResources()))
{
postToSingleResource(event, resource);
}
}
finally
{
ThreadContext.restore(oldContext);
}
}
代码示例来源:origin: org.apache.wicket/wicket-atmosphere
/**
* Post an event to all pages that have a suspended connection. This will invoke the event
* handlers on components, annotated with {@link Subscribe}. The resulting AJAX updates are
* pushed to the clients.
*
* @param event
*/
public void post(Object event)
{
ThreadContext oldContext = ThreadContext.get(false);
try
{
for (AtmosphereResource resource : broadcaster.getAtmosphereResources())
{
postToSingleResource(event, resource);
}
}
finally
{
ThreadContext.restore(oldContext);
}
}
代码示例来源:origin: org.apache.wicket/wicket-core
ThreadContext.restore(old);
代码示例来源:origin: apache/wicket
ThreadContext.restore(old);
代码示例来源:origin: apache/wicket
ThreadContext.restore(previousThreadContext);
代码示例来源:origin: org.apache.wicket/wicket-core
ThreadContext.restore(previousThreadContext);
代码示例来源:origin: at.molindo/molindo-wicket-utils
} finally {
Session newSession = ThreadContext.getSession();
ThreadContext.restore(oldContext);
if (oldSession == null && newSession != null && !newSession.isTemporary()) {
内容来源于网络,如有侵权,请联系作者删除!