org.apache.coyote.Response.setStatus()方法的使用及代码示例

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

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

Response.setStatus介绍

[英]Set the response status
[中]设置响应状态

代码示例

代码示例来源:origin: org.osivia.portal.core/osivia-portal-jbossas-jbossweb-lib

/*      */   /** @deprecated */
/*      */   public void setStatus(int status, String message)
/*      */   {
/* 1342 */     if (isCommitted()) {
/* 1343 */       return;
/*      */     }
/*      */ 
/* 1346 */     if (this.included) {
/* 1347 */       return;
/*      */     }
/* 1349 */     this.coyoteResponse.setStatus(status);
/* 1350 */     this.coyoteResponse.setMessage(message);
/*      */   }

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

@Override
protected boolean handleIncompleteRequestLineRead() {
  // This means that no data is available right now
  // (long keepalive), so that the processor should be recycled
  // and the method should return true
  openSocket = true;
  if (endpoint.isPaused()) {
    // 503 - Service unavailable
    response.setStatus(503);
    adapter.log(request, response, 0);
    error = true;
  } else {
    return true;
  }
  return false;
}

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

/**
 * Set the HTTP status and message to be returned with this response.
 *
 * @param status The new HTTP status
 * @param message The associated text message
 *
 * @deprecated As of Version 2.1 of the Java Servlet API, this method
 *  has been deprecated due to the ambiguous meaning of the message
 *  parameter.
 */
@Override
@Deprecated
public void setStatus(int status, String message) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
protected boolean handleIncompleteRequestLineRead() {
  // This means that no data is available right now
  // (long keepalive), so that the processor should be recycled
  // and the method should return true
  openSocket = true;
  if (endpoint.isPaused()) {
    // 503 - Service unavailable
    response.setStatus(503);
    adapter.log(request, response, 0);
    error = true;
  } else {
    return true;
  }
  return false;
}

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

/**
 * Set the HTTP status and message to be returned with this response.
 *
 * @param status The new HTTP status
 * @param message The associated text message
 *
 * @deprecated As of Version 2.1 of the Java Servlet API, this method
 *  has been deprecated due to the ambiguous meaning of the message
 *  parameter.
 */
@Override
@Deprecated
public void setStatus(int status, String message) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
}

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

/**
 * Set the HTTP status and message to be returned with this response.
 *
 * @param status The new HTTP status
 * @param message The associated text message
 *
 * @deprecated As of Version 2.1 of the Java Servlet API, this method
 *  has been deprecated due to the ambiguous meaning of the message
 *  parameter.
 */
@Override
@Deprecated
public void setStatus(int status, String message) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
}

代码示例来源:origin: tomcat/catalina

/**
 * Set the HTTP status and message to be returned with this response.
 *
 * @param status The new HTTP status
 * @param message The associated text message
 *
 * @deprecated As of Version 2.1 of the Java Servlet API, this method
 *  has been deprecated due to the ambiguous meaning of the message
 *  parameter.
 */
public void setStatus(int status, String message) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
}

代码示例来源:origin: jboss.web/jbossweb

/**
 * Set the HTTP status and message to be returned with this response.
 *
 * @param status The new HTTP status
 * @param message The associated text message
 *
 * @deprecated As of Version 2.1 of the Java Servlet API, this method
 *  has been deprecated due to the ambiguous meaning of the message
 *  parameter.
 */
public void setStatus(int status, String message) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
}

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Set the HTTP status and message to be returned with this response.
 *
 * @param status The new HTTP status
 * @param message The associated text message
 *
 * @deprecated As of Version 2.1 of the Java Servlet API, this method
 *  has been deprecated due to the ambiguous meaning of the message
 *  parameter.
 */
public void setStatus(int status, String message) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
}

代码示例来源:origin: jboss.web/jbossweb

public void endRequest() {
  
  // Finish the handling of the request
  try {
    inputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    log.error(sm.getString("http11processor.request.finish"), t);
    // 500 - Internal Server Error
    response.setStatus(500);
    error = true;
  }
  try {
    outputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    log.error(sm.getString("http11processor.response.finish"), t);
    error = true;
  }
}

代码示例来源:origin: jboss.web/jbossweb

public void endRequest() {
  
  // Finish the handling of the request
  try {
    inputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    log.error(sm.getString("http11processor.request.finish"), t);
    // 500 - Internal Server Error
    response.setStatus(500);
    error = true;
  }
  try {
    outputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    log.error(sm.getString("http11processor.response.finish"), t);
    error = true;
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
protected boolean handleIncompleteRequestLineRead() {
  // This means that no data is available right now
  // (long keepalive), so that the processor should be recycled
  // and the method should return true
  openSocket = true;
  if (endpoint.isPaused()) {
    // 503 - Service unavailable
    response.setStatus(503);
    getAdapter().log(request, response, 0);
    error = true;
  } else {
    return true;
  }
  return false;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private boolean handleIncompleteRequestLineRead() {
  // Haven't finished reading the request so keep the socket
  // open
  openSocket = true;
  // Check to see if we have read any of the request line yet
  if (inputBuffer.getParsingRequestLinePhase() > 1) {
    // Started to read request line.
    if (protocol.isPaused()) {
      // Partially processed the request so need to respond
      response.setStatus(503);
      setErrorState(ErrorState.CLOSE_CLEAN, null);
      return false;
    } else {
      // Need to keep processor associated with socket
      readComplete = false;
    }
  }
  return true;
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Set the HTTP status and message to be returned with this response.
 *
 * @param status The new HTTP status
 * @param message The associated text message
 *
 * @deprecated As of Version 2.1 of the Java Servlet API, this method
 *  has been deprecated due to the ambiguous meaning of the message
 *  parameter.
 */
@Override
@Deprecated
public void setStatus(int status, String message) {
  if (isCommitted()) {
    return;
  }
  // Ignore any call from an included servlet
  if (included) {
    return;
  }
  getCoyoteResponse().setStatus(status);
  getCoyoteResponse().setMessage(message);
}

代码示例来源:origin: org.jboss.web/jbossweb

public void endRequest() {
  
  // Finish the handling of the request
  try {
    inputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    CoyoteLogger.HTTP_LOGGER.errorFinishingRequest(t);
    // 500 - Internal Server Error
    response.setStatus(500);
    error = true;
  }
  try {
    outputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    CoyoteLogger.HTTP_LOGGER.errorFinishingResponse(t);
    error = true;
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

public void endRequest() {
  // Finish the handling of the request
  try {
    inputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    CoyoteLogger.HTTP_LOGGER.errorFinishingRequest(t);
    // 500 - Internal Server Error
    response.setStatus(500);
    error = true;
  }
  try {
    outputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    CoyoteLogger.HTTP_LOGGER.errorFinishingResponse(t);
    error = true;
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

public void endRequest() {
  
  // Finish the handling of the request
  try {
    inputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    CoyoteLogger.HTTP_LOGGER.errorFinishingRequest(t);
    // 500 - Internal Server Error
    response.setStatus(500);
    error = true;
  }
  try {
    outputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    CoyoteLogger.HTTP_LOGGER.errorFinishingResponse(t);
    error = true;
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * {@inheritDoc}
 * <p>
 * This implementation populates the server name and port from the local
 * name and port provided by the AJP message.
 */
@Override
protected void populateHost() {
  // No host information (HTTP/1.0)
  request.setServerPort(request.getLocalPort());
  try {
    request.serverName().duplicate(request.localName());
  } catch (IOException e) {
    response.setStatus(400);
    setErrorState(ErrorState.CLOSE_CLEAN, e);
  }
}

代码示例来源:origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource

public void endRequest() {
  // Finish the handling of the request
  try {
    inputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    log.error(sm.getString("http11processor.request.finish"), t);
    // 500 - Internal Server Error
    response.setStatus(500);
    adapter.log(request, response, 0);
    error = true;
  }
  try {
    outputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    log.error(sm.getString("http11processor.response.finish"), t);
    error = true;
  }
}

代码示例来源:origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource

public void endRequest() {
  
  // Finish the handling of the request
  try {
    inputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    log.error(sm.getString("http11processor.request.finish"), t);
    // 500 - Internal Server Error
    response.setStatus(500);
    adapter.log(request, response, 0);
    error = true;
  }
  try {
    outputBuffer.endRequest();
  } catch (IOException e) {
    error = true;
  } catch (Throwable t) {
    log.error(sm.getString("http11processor.response.finish"), t);
    error = true;
  }
}

相关文章

微信公众号

最新文章

更多