org.simpleframework.http.Response.close()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(134)

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

Response.close介绍

[英]This is used to close the connection and commit the request. This provides the same semantics as closing the output stream and ensures that the HTTP response is committed. This will throw an exception if the response can not be committed.
[中]这用于关闭连接并提交请求。这提供了与关闭输出流相同的语义,并确保提交HTTP响应。如果无法提交响应,这将引发异常。

代码示例

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

private void close(final Response response) {
  try {
    response.close();
  } catch (final Exception ex) {
    throw new RuntimeException(ex);
  }
}

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

@Override
public void commit() {
  try {
    response.close();
  } catch (final IOException e) {
    logger.log(Level.SEVERE, "Unable to send 500 error response.", e);
  } finally {
    logger.debugLog("commit() called");
  }
}

代码示例来源:origin: SonarSource/sonarqube

} finally {
 try {
  resp.close();
 } catch (IOException ignored) {

代码示例来源:origin: org.simpleframework/simple

/**
* This is used to close the connection and commit the request. 
* This provides the same semantics as closing the output stream
* and ensures that the HTTP response is committed. This will
* throw an exception if the response can not be committed.
* 
* @throws IOException thrown if there is a problem writing
*/
public void close() throws IOException {
 response.close();
}

代码示例来源:origin: org.simpleframework/simple-http

/**
* This is used to close the connection and commit the request. 
* This provides the same semantics as closing the output stream
* and ensures that the HTTP response is committed. This will
* throw an exception if the response can not be committed.
* 
* @throws IOException thrown if there is a problem writing
*/
public void close() throws IOException {
 response.close();
}

代码示例来源:origin: ngallagher/simpleframework

/**
* This is used to close the connection and commit the request. 
* This provides the same semantics as closing the output stream
* and ensures that the HTTP response is committed. This will
* throw an exception if the response can not be committed.
* 
* @throws IOException thrown if there is a problem writing
*/
public void close() throws IOException {
 response.close();
}

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

@Override
protected void closeResponse() throws IOException {
  response.close();
}

代码示例来源:origin: CodeStory/fluent-http

@Override
public void close() throws IOException {
 response.close();
}

代码示例来源:origin: com.sun.jersey.contribs/jersey-simple-server

public void finish() throws IOException {
    response.close();
  }
}

代码示例来源:origin: io.restx/restx-server-simple

@Override
protected void closeResponse() throws IOException {
  response.close();
}

代码示例来源:origin: com.sun.jersey.contribs/jersey-simple-server

private void close(Response response) {
  try {
    response.close();
  } catch (Exception ex) {
    throw new RuntimeException(ex);
  }
}

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

private void close(final Response response) {
  try {
    response.close();
  } catch (final Exception ex) {
    throw new RuntimeException(ex);
  }
}

代码示例来源:origin: miltonio/milton2

@Override
public void close() {
  if( disableClose ) {
    return ;
  }
  try {
    baseResponse.close();
    log.debug("request completed in: " + (System.currentTimeMillis()-started));
  } catch (Exception ex) {
    log.error("exception closing response", ex);
  }
}

代码示例来源:origin: miltonio/milton2

public void closeReally() {
    try {
//            log.debug("..doing close: " + baseResponse.getClass());
      baseResponse.close();
      if( log.isInfoEnabled()){
        log.info("request completed in: " + (System.currentTimeMillis()-started));
      }
    } catch (Throwable ex) {
      log.error("exception closing", ex);
    }
  }

代码示例来源:origin: miltonio/milton2

private void respondError(Task t) {
    try {
      log.warn("setting error status becaue request could not be processed");
      t.response.setCode(500);
//            t.response.commit();
      t.response.close();
    } catch (Exception e) {
      log.error("error setting last chance error status", e);
    }
  }

代码示例来源:origin: miltonio/milton2

private void respondError( Task t ) {
    try {
      log.warn( "setting error status becaue request could not be processed" );
      t.response.setCode( 500 );
//            t.response.commit();
      t.response.close();
    } catch( Exception e ) {
      log.error( "error setting last chance error status", e );
    }
  }

代码示例来源:origin: miltonio/milton2

private void respondFinalError(Task t) {
  try {
    log.warn("setting error status becaue request could not be processed");
    t.response.setCode(500);
    //            t.response.commit();
    t.response.close();
  } catch (Exception e) {
    log.error("error setting last chance error status", e);
  }
}

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

@Override
public void commit() {
  try {
    response.close();
  } catch (final IOException e) {
    logger.log(Level.SEVERE, "Unable to send 500 error response.", e);
  } finally {
    logger.debugLog("commit() called");
  }
}

代码示例来源:origin: org.simpleframework/simple-http

/**
  * This method is used to terminate the connection and commit the
  * response. Terminating the session before it has been dispatched
  * is done when there is a protocol or an unexpected I/O error with
  * the underlying TCP channel. 
  * 
  * @param request this is the session initiating request
  * @param response this is the session initiating response
  */
  public void terminate(Request request, Response response) {
   Channel channel = request.getChannel();
   Trace trace = channel.getTrace();
   
   try {
     response.close();
     channel.close();
     trace.trace(TERMINATE_SOCKET);
   } catch(Exception cause) {
     trace.trace(ERROR, cause);
   }
  }
}

代码示例来源:origin: ngallagher/simpleframework

/**
  * This method is used to terminate the connection and commit the
  * response. Terminating the session before it has been dispatched
  * is done when there is a protocol or an unexpected I/O error with
  * the underlying TCP channel. 
  * 
  * @param request this is the session initiating request
  * @param response this is the session initiating response
  */
  public void terminate(Request request, Response response) {
   Channel channel = request.getChannel();
   Trace trace = channel.getTrace();
   
   try {
     response.close();
     channel.close();
     trace.trace(TERMINATE_SOCKET);
   } catch(Exception cause) {
     trace.trace(ERROR, cause);
   }
  }
}

相关文章