本文整理了Java中org.eclipse.jetty.server.Request.getAsyncContext
方法的一些代码示例,展示了Request.getAsyncContext
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getAsyncContext
方法的具体详情如下:
包路径:org.eclipse.jetty.server.Request
类名称:Request
方法名:getAsyncContext
暂无
代码示例来源:origin: jooby-project/jooby
@Override
protected void handshake(final Runnable handler) throws Exception {
/** Infinite timeout because the continuation is never resumed but only completed on close. */
req.getAsyncContext().setTimeout(0L);
/** Server sent events headers. */
rsp.setStatus(HttpServletResponse.SC_OK);
rsp.setHeader("Connection", "Close");
rsp.setContentType("text/event-stream; charset=utf-8");
rsp.flushBuffer();
HttpChannel channel = rsp.getHttpChannel();
Connector connector = channel.getConnector();
Executor executor = connector.getExecutor();
executor.execute(handler);
}
代码示例来源:origin: stackoverflow.com
request.getAsyncContext().complete();
代码示例来源:origin: jenkinsci/winstone
public void complete (Session session, Request request)
{
if (request.isAsyncStarted() && request.getDispatcherType() == DispatcherType.REQUEST)
{
request.getAsyncContext().addListener(new SessionAsyncListener(session));
}
else
{
complete(session);
}
//if dispatcher type is not async and not request, complete immediately (its a forward or an include)
//else if dispatcher type is request and not async, complete immediately
//else register an async callback completion listener that will complete the session
}
代码示例来源:origin: org.jooby/jooby-jetty
@Override
protected void handshake(final Runnable handler) throws Exception {
/** Infinite timeout because the continuation is never resumed but only completed on close. */
req.getAsyncContext().setTimeout(0L);
/** Server sent events headers. */
rsp.setStatus(HttpServletResponse.SC_OK);
rsp.setHeader("Connection", "Close");
rsp.setContentType("text/event-stream; charset=utf-8");
rsp.flushBuffer();
HttpChannel channel = rsp.getHttpChannel();
Connector connector = channel.getConnector();
Executor executor = connector.getExecutor();
executor.execute(handler);
}
代码示例来源:origin: Nextdoor/bender
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
try
{
super.handle(target, baseRequest, request, response);
}
catch(Error|IOException|ServletException|RuntimeException e)
{
if (!response.isCommitted() && !baseRequest.getHttpChannelState().isAsync())
response.setStatus(500);
throw e;
}
finally
{
if (_requestLog != null && baseRequest.getDispatcherType().equals(DispatcherType.REQUEST))
{
if (baseRequest.getHttpChannelState().isAsync())
{
if (baseRequest.getHttpChannelState().isInitial())
baseRequest.getAsyncContext().addListener(_listener);
}
else
_requestLog.log(baseRequest, (Response)response);
}
}
}
代码示例来源:origin: Nextdoor/bender
if (!committed)
LOG.warn("Could not send response error 500: "+x);
_request.getAsyncContext().complete();
内容来源于网络,如有侵权,请联系作者删除!