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

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

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

Response.finish介绍

[英]Perform whatever actions are required to flush and close the output stream or writer, in a single operation.
[中]在单个操作中执行刷新和关闭输出流或写入程序所需的任何操作。

代码示例

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

public void finish() throws IOException {

    if (response == null) {
      throw new IllegalStateException("Null response object");
    }

//        response.setSuspended(true);
    response.finish();

  }

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

public void finish() throws IOException {

    if (response == null) {
      throw new IllegalStateException("Null response object");
    }

//        response.setSuspended(true);
    response.finish();

  }

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

public void finish() throws IOException {

    if (response == null) {
      throw new IllegalStateException("Null response object");
    }

//        response.setSuspended(true);
    response.finish();

  }

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

public void finish() throws IOException {

    if (response == null) {
      throw new IllegalStateException("Null response object");
    }

//        response.setSuspended(true);
    response.finish();

  }

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

public void finish() throws IOException {

    if (response == null) {
      throw new IllegalStateException("Null response object");
    }

//        response.setSuspended(true);
    response.finish();

  }

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

public void finish() throws IOException {

    if (response == null) {
      throw new IllegalStateException("Null response object");
    }

//        response.setSuspended(true);
    response.finish();

  }

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

@Override
public void fail() throws IOException {
  if (isAcknowledged) {
    throw new IllegalStateException("Already acknowledged");
  }
  isAcknowledged = true;
  isFailAcknowledgement = true;
  
  response.setStatus(HttpStatus.EXPECTATION_FAILED_417);
  response.finish();
}

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

@Override
public void fail() throws IOException {
  if (isAcknowledged) {
    throw new IllegalStateException("Already acknowledged");
  }
  isAcknowledged = true;
  isFailAcknowledgement = true;
  
  response.setStatus(HttpStatus.EXPECTATION_FAILED_417);
  response.finish();
}

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

@Override
public void fail() throws IOException {
  if (isAcknowledged) {
    throw new IllegalStateException("Already acknowledged");
  }
  isAcknowledged = true;
  isFailAcknowledgement = true;
  
  response.setStatus(HttpStatus.EXPECTATION_FAILED_417);
  response.finish();
}

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

@Override
public void fail() throws IOException {
  if (isAcknowledged) {
    throw new IllegalStateException("Already acknowledged");
  }
  isAcknowledged = true;
  isFailAcknowledgement = true;
  
  response.setStatus(HttpStatus.EXPECTATION_FAILED_417);
  response.finish();
}

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

@Override
public void fail() throws IOException {
  if (isAcknowledged) {
    throw new IllegalStateException("Already acknowledged");
  }
  isAcknowledged = true;
  isFailAcknowledgement = true;
  
  response.setStatus(HttpStatus.EXPECTATION_FAILED_417);
  response.finish();
}

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

@Override
public void fail() throws IOException {
  if (isAcknowledged) {
    throw new IllegalStateException("Already acknowledged");
  }
  isAcknowledged = true;
  isFailAcknowledgement = true;
  
  response.setStatus(HttpStatus.EXPECTATION_FAILED_417);
  response.finish();
}

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

@Override
public void onError(Throwable t) {
  LOGGER.log(Level.WARNING, "[onError]", t);
  response.setStatus(500, t.getMessage());
  complete(true);
  
  if (response.isSuspended()) {
    response.resume();
  } else {
    response.finish();                    
  }
}

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

private void doClose() throws IOException {
  getResponse().finish();
}

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

/**
 * Interrupt logic in its own method, so it can be executed either async or sync.<br> cometHandler.onInterrupt is
 * performed async due to its functionality is unknown, hence not safe to run in the performance critical selector
 * thread.
 *
 * @param handler The {@link CometHandler} encapsulating the suspended connection.
 * @param finishExecution Finish the current execution.
 *
 * @see CometContext#interrupt0(CometHandler, boolean)
 * @deprecated use the CometContext version
 */
protected void interrupt0(CometHandler handler, boolean finishExecution) throws IOException {
  if (finishExecution) {
    try {
      handler.onInterrupt(handler.getCometContext().eventInterrupt);
    } catch (IOException e) {
    }
  }
  handler.getResponse().finish();
}

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

/**
 * Interrupt logic in its own method, so it can be executed either async or sync.<br> cometHandler.onInterrupt is
 * performed async due to its functionality is unknown, hence not safe to run in the performance critical selector
 * thread.
 *
 * @param handler The {@link CometHandler} encapsulating the suspended connection.
 * @param finishExecution Finish the current execution.
 *
 * @see CometContext#interrupt0(CometHandler, boolean)
 * @deprecated use the CometContext version
 */
protected void interrupt0(CometHandler handler, boolean finishExecution) throws IOException {
  if (finishExecution) {
    try {
      handler.onInterrupt(handler.getCometContext().eventInterrupt);
    } catch (IOException e) {
    }
  }
  handler.getResponse().finish();
}

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

/**
 * Interrupt logic in its own method, so it can be executed either async or sync.<br> cometHandler.onInterrupt is
 * performed async due to its functionality is unknown, hence not safe to run in the performance critical selector
 * thread.
 *
 * @param handler The {@link CometHandler} encapsulating the suspended connection.
 * @param finishExecution Finish the current execution.
 *
 * @see CometContext#interrupt0(CometHandler, boolean)
 * @deprecated use the CometContext version
 */
protected void interrupt0(CometHandler handler, boolean finishExecution) throws IOException {
  if (finishExecution) {
    try {
      handler.onInterrupt(handler.getCometContext().eventInterrupt);
    } catch (IOException e) {
    }
  }
  handler.getResponse().finish();
}

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

/**
 * Interrupt logic in its own method, so it can be executed either async or sync.<br> cometHandler.onInterrupt is
 * performed async due to its functionality is unknown, hence not safe to run in the performance critical selector
 * thread.
 *
 * @param handler The {@link CometHandler} encapsulating the suspended connection.
 * @param finishExecution Finish the current execution.
 *
 * @see CometContext#interrupt0(CometHandler, boolean)
 * @deprecated use the CometContext version
 */
protected void interrupt0(CometHandler handler, boolean finishExecution) throws IOException {
  if (finishExecution) {
    try {
      handler.onInterrupt(handler.getCometContext().eventInterrupt);
    } catch (IOException e) {
    }
  }
  handler.getResponse().finish();
}

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

/**
 * Interrupt logic in its own method, so it can be executed either async or sync.<br> cometHandler.onInterrupt is
 * performed async due to its functionality is unknown, hence not safe to run in the performance critical selector
 * thread.
 *
 * @param handler The {@link CometHandler} encapsulating the suspended connection.
 * @param finishExecution Finish the current execution.
 *
 * @see CometContext#interrupt0(CometHandler, boolean)
 * @deprecated use the CometContext version
 */
protected void interrupt0(CometHandler handler, boolean finishExecution) throws IOException {
  if (finishExecution) {
    try {
      handler.onInterrupt(handler.getCometContext().eventInterrupt);
    } catch (IOException e) {
    }
  }
  handler.getResponse().finish();
}

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

private void reportAuthFailure(final Response res,
    final ActionReport report,
    final String msgKey,
    final String msg,
    final int httpStatus,
    final String headerName,
    final String headerValue) throws IOException {
  report.setActionExitCode(ActionReport.ExitCode.FAILURE);
  final String messageForResponse = adminStrings.getLocalString(msgKey, msg);
  report.setMessage(messageForResponse);
  report.setActionDescription("Authentication error");
  res.setStatus(httpStatus, messageForResponse);
  if (headerName != null) {
    res.setHeader(headerName, headerValue);
  }
  res.setContentType(report.getContentType());
  report.writeReport(res.getOutputStream());
  res.getOutputStream().flush();
  res.finish();
}

相关文章

微信公众号

最新文章

更多

Response类方法