本文整理了Java中org.restlet.Context.setCurrent()
方法的一些代码示例,展示了Context.setCurrent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.setCurrent()
方法的具体详情如下:
包路径:org.restlet.Context
类名称:Context
方法名:setCurrent
[英]Sets the context to associated with the current thread.
[中]将上下文设置为与当前线程关联。
代码示例来源: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.osgi/org.restlet
/**
* Handles a call.
*
* @param request
* The request to handle.
* @param response
* The response to update.
*/
public void handle(Request request, Response response) {
// Associate the response to the current thread
Response.setCurrent(response);
// Associate the context to the current thread
if (getContext() != null) {
Context.setCurrent(getContext());
}
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Handles a call.
*
* @param request
* The request to handle.
* @param response
* The response to update.
*/
public void handle(Request request, Response response) {
// Associate the response to the current thread
Response.setCurrent(response);
// Associate the context to the current thread
if (getContext() != null) {
Context.setCurrent(getContext());
}
}
代码示例来源:origin: org.restlet/org.restlet
/**
* Handles the call by distributing it to the next Restlet. If no Restlet is
* attached, then a {@link Status#SERVER_ERROR_INTERNAL} status is returned.
* Returns {@link #CONTINUE} by default.
*
* @param request
* The request to handle.
* @param response
* The response to update.
* @return The continuation status. Either {@link #CONTINUE} or
* {@link #STOP}.
*/
protected int doHandle(Request request, Response response) {
final int result = CONTINUE;
if (getNext() != null) {
getNext().handle(request, response);
// Re-associate the response to the current thread
Response.setCurrent(response);
// Associate the context to the current thread
if (getContext() != null) {
Context.setCurrent(getContext());
}
} else {
response.setStatus(Status.SERVER_ERROR_INTERNAL);
getLogger()
.warning(
"A filter was executed without a next Restlet attached to it.");
}
return result;
}
代码示例来源:origin: org.restlet/org.restlet.ext.servlet
if (getTarget() != null) {
Context.setCurrent(getContext());
代码示例来源:origin: org.restlet/org.restlet
Context.setCurrent(getContext());
代码示例来源:origin: com.noelios.restlet/com.noelios.restlet.ext.servlet
if (getTarget() != null) {
Context.setCurrent(getContext());
代码示例来源:origin: org.restlet/org.restlet.ext.servlet
if (getTarget() != null) {
Context.setCurrent(getContext());
代码示例来源:origin: org.restlet.osgi/org.restlet
Context.setCurrent(getContext());
代码示例来源:origin: org.restlet.osgi/org.restlet
Context.setCurrent(getContext());
内容来源于网络,如有侵权,请联系作者删除!