com.sun.grizzly.tcp.http11.GrizzlyResponse.isCommitted()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(76)

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

GrizzlyResponse.isCommitted介绍

[英]Has the output of this response already been committed?
[中]此响应的输出是否已提交?

代码示例

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

/**
 * Set the specified integer header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Integer value to be set
 */
public void setIntHeader(String name, int value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  setHeader(name, "" + value);
}

代码示例来源:origin: com.sun.grizzly/grizzly-utils

/**
 * Set the specified integer header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Integer value to be set
 */
public void setIntHeader(String name, int value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  setHeader(name, "" + value);
}

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

/**
 * Send an acknowledgment of a request.
 * 
 * @exception IOException if an input/output error occurs
 */
public void sendAcknowledgement()
  throws IOException {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return; 
  response.acknowledge();
}

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

public void setCharacterEncoding(String charset) {
  if (isCommitted())
    return;
  
  // Ignore any call from an included servlet
  if (included)
    return;     
  
  // Ignore any call made after the getWriter has been invoked
  // The default should be used
  if (usingWriter)
    return;
  response.setCharacterEncoding(charset);
  isCharacterEncodingSet = true;
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

/**
 * Add the specified integer header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Integer value to be set
 */
public void addIntHeader(String name, int value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  addHeader(name, "" + value);
}

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

/**
 * Add the specified header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Value to be set
 */
public void addHeader(String name, String value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  response.addHeader(name, value);
}

代码示例来源:origin: com.sun.grizzly/grizzly-utils

/**
 * Add the specified integer header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Integer value to be set
 */
public void addIntHeader(String name, int value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  addHeader(name, "" + value);
}

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

/**
 * Reset the data buffer but not any status or header information.
 *
 * @exception IllegalStateException if the response has already
 *  been committed
 */
public void resetBuffer() {
  if (isCommitted())
    throw new IllegalStateException
      (sm.getString("response.resetBuffer.ise"));
  outputBuffer.reset();
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

/**
 * Reset the data buffer but not any status or header information.
 *
 * @exception IllegalStateException if the response has already
 *  been committed
 */
public void resetBuffer() {
  if (isCommitted())
    throw new IllegalStateException
      (sm.getString("response.resetBuffer.ise"));
  outputBuffer.reset();
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

public void setCharacterEncoding(String charset) {
  checkResponse();
  if (isCommitted())
    return;
  
  // Ignore any call from an included servlet
  if (included)
    return;     
  
  // Ignore any call made after the getWriter has been invoked
  // The default should be used
  if (usingWriter)
    return;
  response.setCharacterEncoding(charset);
  isCharacterEncodingSet = true;
}

代码示例来源:origin: com.sun.grizzly/grizzly-utils

public void setCharacterEncoding(String charset) {
  checkResponse();
  if (isCommitted())
    return;
  
  // Ignore any call from an included servlet
  if (included)
    return;     
  
  // Ignore any call made after the getWriter has been invoked
  // The default should be used
  if (usingWriter)
    return;
  response.setCharacterEncoding(charset);
  isCharacterEncodingSet = true;
}

代码示例来源:origin: com.sun.grizzly/grizzly-utils

/**
 * Send an acknowledgment of a request.
 * 
 * @exception IOException if an input/output error occurs
 */
public void sendAcknowledgement() throws IOException {
  checkResponse();
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return; 
  response.acknowledge();
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

/**
 * Send an acknowledgment of a request.
 * 
 * @exception IOException if an input/output error occurs
 */
public void sendAcknowledgement() throws IOException {
  checkResponse();
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return; 
  response.acknowledge();
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

/**
 * Add the specified header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Value to be set
 */
public void addHeader(String name, String value) {
  checkResponse();
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  response.addHeader(name, value);
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

/**
 * Set the specified header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Value to be set
 */
public void setHeader(String name, String value) {
  checkResponse();
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  response.setHeader(name, value);
}

代码示例来源:origin: com.sun.grizzly/grizzly-utils

/**
 * Set the buffer size to be used for this Response.
 *
 * @param size The new buffer size
 *
 * @exception IllegalStateException if this method is called after
 *  output has been committed for this response
 */
public void setBufferSize(int size) {
  if (isCommitted() || !outputBuffer.isNew())
    throw new IllegalStateException
      (sm.getString("response.setBufferSize.ise"));
  outputBuffer.setBufferSize(size);
}

代码示例来源:origin: com.sun.grizzly/grizzly-utils

/**
 * Application commit flag accessor.
 */
public boolean isAppCommitted() {
  return (this.appCommitted || isCommitted() || isBufferSuspended()
      || ((getContentLength() > 0) 
        && (getContentCount() >= getContentLength())));
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

/**
 * Application commit flag accessor.
 */
public boolean isAppCommitted() {
  return (this.appCommitted || isCommitted() || isBufferSuspended()
      || ((getContentLength() > 0) 
        && (getContentCount() >= getContentLength())));
}

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

/**
 * Application commit flag accessor.
 */
public boolean isAppCommitted() {
  return (this.appCommitted || isCommitted() || isSuspended()
      || ((getContentLength() > 0) 
        && (getContentCount() >= getContentLength())));
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

@Override
public void timeout(boolean forceClose){
  // If the buffers are empty, commit the response header
  try{                             
    getCompletionHandler().cancelled(getAttachment());   
  } finally {
    if (forceClose &&!gres.isCommitted()){
      try{
        gres.finishResponse();
      } catch (IOException ex){
        // Swallow?
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多