本文整理了Java中org.restlet.Application.setCurrent()
方法的一些代码示例,展示了Application.setCurrent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.setCurrent()
方法的具体详情如下:
包路径:org.restlet.Application
类名称:Application
方法名:setCurrent
[英]Sets the context to associated with the current thread.
[中]将上下文设置为与当前线程关联。
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* In addition to the default behavior, it saves the current application
* instance into the current thread.
*
* @param request
* The request to handle.
* @param response
* The response to update.
*/
@Override
public void handle(Request request, Response response) {
Application current = Application.getCurrent();
// Save the current application
Application.setCurrent(getHelped());
// Actually handle call
try {
super.handle(request, response);
} finally {
// restaure the current application
Application.setCurrent(current);
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Clears the thread local variables set by the Restlet API and engine.
*/
public static void clearThreadLocalVariables() {
Response.setCurrent(null);
Context.setCurrent(null);
org.restlet.routing.VirtualHost.setCurrent(null);
org.restlet.Application.setCurrent(null);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
@Override
public void run() {
// Copy the thread local variables
Response.setCurrent(currentResponse);
Context.setCurrent(currentContext);
org.restlet.routing.VirtualHost.setCurrent(currentVirtualHost);
org.restlet.Application.setCurrent(currentApplication);
try {
// Run the user task
runnable.run();
} finally {
Engine.clearThreadLocalVariables();
}
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl
Application.setCurrent(this);
内容来源于网络,如有侵权,请联系作者删除!