org.apache.catalina.connector.Response.setError()方法的使用及代码示例

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

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

Response.setError介绍

[英]Set the error flag.
[中]设置错误标志。

代码示例

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

/**
 * Handle the specified ServletException encountered while processing
 * the specified Request to produce the specified Response.  Any
 * exceptions that occur during generation of the exception report are
 * logged and swallowed.
 *
 * @param request The request being processed
 * @param response The response being generated
 * @param exception The exception that occurred (which possibly wraps
 *  a root cause exception
 */
private void exception(Request request, Response response,
            Throwable exception) {
  request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, exception);
  response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  response.setError();
}

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

/**
 * Handle the specified ServletException encountered while processing
 * the specified Request to produce the specified Response.  Any
 * exceptions that occur during generation of the exception report are
 * logged and swallowed.
 *
 * @param request The request being processed
 * @param response The response being generated
 * @param exception The exception that occurred (which possibly wraps
 *  a root cause exception
 */
private void exception(Request request, Response response,
            Throwable exception) {
  request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, exception);
  response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  response.setError();
}

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

/**
 * Send an error response with the specified status and message.
 *
 * @param status HTTP status code to send
 * @param message Corresponding message to send
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
public void sendError(int status, String message) 
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException(rb.getString(LogFacade.CANNOT_CALL_SEND_ERROR_EXCEPTION));
  // Ignore any call from an included servlet
  if (included) {
    return; 
  }
  setError();
  coyoteResponse.setStatus(status);
  // use encoding in GlassFish
  coyoteResponse.getResponse().setHtmlEncodingCustomReasonPhrase(false);
  coyoteResponse.setDetailMessage(HtmlEntityEncoder.encodeXSS(message));
  // Clear any data content that has been buffered
  resetBuffer();
  // Cause the response to be finished (from the application perspective)
  setSuspended(true);
}

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

/**
 * Send an error response with the specified status and message.
 *
 * @param status HTTP status code to send
 * @param message Corresponding message to send
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
@Override
public void sendError(int status, String message) throws IOException {
  if (isCommitted()) {
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendError.ise"));
  }
  // Ignore any call from an included servlet
  if (included) {
    return;
  }
  setError();
  getCoyoteResponse().setStatus(status);
  getCoyoteResponse().setMessage(message);
  // Clear any data content that has been buffered
  resetBuffer();
  // Cause the response to be finished (from the application perspective)
  setSuspended(true);
}

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

response.setError();

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

/**
 * Send an error response with the specified status and message.
 *
 * @param status HTTP status code to send
 * @param message Corresponding message to send
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
@Override
public void sendError(int status, String message) throws IOException {
  if (isCommitted()) {
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendError.ise"));
  }
  // Ignore any call from an included servlet
  if (included) {
    return;
  }
  setError();
  getCoyoteResponse().setStatus(status);
  getCoyoteResponse().setMessage(message);
  // Clear any data content that has been buffered
  resetBuffer();
  // Cause the response to be finished (from the application perspective)
  setSuspended(true);
}

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

/*      */   public void sendError(int status, String message)
/*      */     throws IOException
/*      */   {
/* 1188 */     if (isCommitted()) {
/* 1189 */       throw new IllegalStateException(sm.getString("coyoteResponse.sendError.ise"));
/*      */     }
/*      */ 
/* 1193 */     if (this.included) {
/* 1194 */       return;
/*      */     }
/* 1196 */     Wrapper wrapper = getRequest().getWrapper();
/* 1197 */     if (wrapper != null) {
/* 1198 */       wrapper.incrementErrorCount();
/*      */     }
/*      */ 
/* 1201 */     setError();
/*      */ 
/* 1203 */     this.coyoteResponse.setStatus(status);
/* 1204 */     this.coyoteResponse.setMessage(message);
/*      */ 
/* 1207 */     resetBuffer();
/*      */ 
/* 1210 */     setSuspended(true);
/*      */   }
/*      */

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

/**
 * Send an error response with the specified status and message.
 *
 * @param status HTTP status code to send
 * @param message Corresponding message to send
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
public void sendError(int status, String message) 
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendError.ise"));
  // Ignore any call from an included servlet
  if (included)
    return; 
  Wrapper wrapper = getRequest().getWrapper();
  if (wrapper != null) {
    wrapper.incrementErrorCount();
  } 
  setError();
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
  // Clear any data content that has been buffered
  resetBuffer();
  // Cause the response to be finished (from the application perspective)
  setSuspended(true);
}

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

setError();

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

setError();

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

/**
 * Send an error response with the specified status and message.
 *
 * @param status HTTP status code to send
 * @param message Corresponding message to send
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
public void sendError(int status, String message) 
  throws IOException {
  if (isCommitted())
    throw new IllegalStateException
      (sm.getString("coyoteResponse.sendError.ise"));
  // Ignore any call from an included servlet
  if (included)
    return; 
  Wrapper wrapper = getRequest().getWrapper();
  if (wrapper != null) {
    wrapper.incrementErrorCount();
  } 
  setError();
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
  // Clear any data content that has been buffered
  resetBuffer();
  // Cause the response to be finished (from the application perspective)
  setSuspended(true);
}

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

setError();

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

setError();

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

setError();

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

setError();

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

response.setError();

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

response.setError();

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

/**
 * Send an error response with the specified status and message.
 *
 * @param status HTTP status code to send
 * @param message Corresponding message to send
 *
 * @exception IllegalStateException if this response has
 *  already been committed
 * @exception IOException if an input/output error occurs
 */
public void sendError(int status, String message) 
  throws IOException {
  if (isCommitted())
    throw MESSAGES.cannotSendError();
  // Ignore any call from an included servlet
  if (included)
    return; 
  Wrapper wrapper = getRequest().getWrapper();
  if (wrapper != null) {
    wrapper.incrementErrorCount();
  } 
  setError();
  coyoteResponse.setStatus(status);
  coyoteResponse.setMessage(message);
  // Clear any data content that has been buffered
  resetBuffer();
  // Cause the response to be finished (from the application perspective)
  setSuspended(true);
}

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

response.setError();

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

response.setError();

相关文章

Response类方法