org.eclipse.jetty.server.Response.newResponseInfo()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.eclipse.jetty.server.Response.newResponseInfo方法的一些代码示例,展示了Response.newResponseInfo的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.newResponseInfo方法的具体详情如下:
包路径:org.eclipse.jetty.server.Response
类名称:Response
方法名:newResponseInfo

Response.newResponseInfo介绍

暂无

代码示例

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * <p>Requests to write (in a blocking way) the given response content buffer,
 * committing the response if needed.</p>
 *
 * @param content  the content buffer to write
 * @param complete whether the content is complete for the response
 * @throws IOException if the write fails
 */
protected void write(ByteBuffer content, boolean complete) throws IOException
{
  if (isCommitted())
  {
    _transport.send(null, content, complete);
  }
  else
  {
    ResponseInfo info = _response.newResponseInfo();
    boolean committed = commitResponse(info, content, complete);
    if (!committed)
      throw new IOException("Concurrent commit");
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * <p>Requests to write (in a blocking way) the given response content buffer,
 * committing the response if needed.</p>
 *
 * @param content  the content buffer to write
 * @param complete whether the content is complete for the response
 * @throws IOException if the write fails
 */
protected void write(ByteBuffer content, boolean complete) throws IOException
{
  if (isCommitted())
  {
    _transport.send(null, content, complete);
  }
  else
  {
    ResponseInfo info = _response.newResponseInfo();
    boolean committed = commitResponse(info, content, complete);
    if (!committed)
      throw new IOException("Concurrent commit");
  }
}

代码示例来源:origin: Nextdoor/bender

protected boolean sendResponse(ResponseInfo info, ByteBuffer content, boolean complete, final Callback callback)
{
  boolean committing = _committed.compareAndSet(false, true);
  if (committing)
  {
    // We need an info to commit
    if (info==null)
      info = _response.newResponseInfo();
    // wrap callback to process 100 responses
    final int status=info.getStatus();
    final Callback committed = (status<200&&status>=100)?new Commit100Callback(callback):new CommitCallback(callback);
    // committing write
    _transport.send(info, content, complete, committed);
  }
  else if (info==null)
  {
    // This is a normal write
    _transport.send(content, complete, callback);
  }
  else
  {
    callback.failed(new IllegalStateException("committed"));
  }
  return committing;
}

相关文章