org.glassfish.grizzly.http.server.Response.reset()方法的使用及代码示例

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

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

Response.reset介绍

[英]Clears any data that exists in the buffer as well as the status code and headers.
[中]清除缓冲区中存在的所有数据以及状态代码和标头。

代码示例

代码示例来源:origin: jersey/jersey

@Override
@SuppressWarnings("MagicNumber")
public void failure(final Throwable error) {
  try {
    if (!grizzlyResponse.isCommitted()) {
      try {
        if (configSetStatusOverSendError) {
          grizzlyResponse.reset();
          grizzlyResponse.setStatus(500, "Request failed.");
        } else {
          grizzlyResponse.sendError(500, "Request failed.");
        }
      } catch (final IllegalStateException ex) {
        // a race condition externally committing the response can still occur...
        logger.log(Level.FINER, "Unable to reset failed response.", ex);
      } catch (final IOException ex) {
        throw new ContainerException(
            LocalizationMessages.EXCEPTION_SENDING_ERROR_RESPONSE(500, "Request failed."),
            ex);
      }
    }
  } finally {
    logger.debugLog("{0} - failure(...) called", name);
    rethrow(error);
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

/**
 * Clear any content written to the buffer.
 *
 * @exception IllegalStateException if this response has already
 *  been committed
 */
public void reset() {
  if (included)
    return;     // Ignore any call from an included servlet
  coyoteResponse.reset();
  outputBuffer.reset();
  // reset Grizzly duplicated internal attributes
  coyoteResponse.resetBuffer(true);
  usingOutputStream = false;
  usingWriter = false;
  isCharacterEncodingSet = false;
}

代码示例来源:origin: javaee/grizzly

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public void reset() {
  if (isCommitted())
    throw new IllegalStateException("Illegal attempt to reset the response after it has already been committed.");
  response.reset();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * {@inheritDoc}
 */
@Override
public void reset() {
  if (isCommitted())
    throw new IllegalStateException("Illegal attempt to reset the response after it has already been committed.");
  response.reset();
}

代码示例来源:origin: javaee/grizzly

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: javaee/grizzly

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: javaee/grizzly

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: javaee/grizzly

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public void reset() {
  if (isCommitted())
    throw new IllegalStateException("Illegal attempt to reset the response after it has already been committed.");
  response.reset();
}

代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-http-server

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public void reset() {
  if (isCommitted())
    throw new IllegalStateException("Illegal attempt to reset the response after it has already been committed.");
  response.reset();
}

代码示例来源:origin: javaee/grizzly

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public void reset() {
  if (isCommitted())
    throw new IllegalStateException("Illegal attempt to reset the response after it has already been committed.");
  response.reset();
}

代码示例来源:origin: javaee/grizzly

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public void reset() {
  if (isCommitted())
    throw new IllegalStateException("Illegal attempt to reset the response after it has already been committed.");
  response.reset();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

/**
 * Reset this response, and specify the values for the HTTP status code
 * and corresponding message.
 *
 * @exception IllegalStateException if this response has already been
 *  committed
 */
public void reset(final int status, final String message) {
  reset();
  setStatus(status, message);
}

代码示例来源:origin: org.glassfish.jersey.containers/jersey-container-grizzly2-http

@Override
@SuppressWarnings("MagicNumber")
public void failure(final Throwable error) {
  try {
    if (!grizzlyResponse.isCommitted()) {
      try {
        if (configSetStatusOverSendError) {
          grizzlyResponse.reset();
          grizzlyResponse.setStatus(500, "Request failed.");
        } else {
          grizzlyResponse.sendError(500, "Request failed.");
        }
      } catch (final IllegalStateException ex) {
        // a race condition externally committing the response can still occur...
        logger.log(Level.FINER, "Unable to reset failed response.", ex);
      } catch (final IOException ex) {
        throw new ContainerException(
            LocalizationMessages.EXCEPTION_SENDING_ERROR_RESPONSE(500, "Request failed."),
            ex);
      }
    }
  } finally {
    logger.debugLog("{0} - failure(...) called", name);
    rethrow(error);
  }
}

相关文章

微信公众号

最新文章

更多

Response类方法