httpexception.java

来自「21天学通java的示例程序源代码」· Java 代码 · 共 35 行

JAVA
35
字号
// HTTPException.java

package com.wrox.httpserver;

/**
 * This exception is thrown when an exception occurs while
 * processing an HTTP request.
 */
class HTTPException extends Exception {

  // HTTP status code
  private int status;

  /**
   * Constructs an HTTPException with the specified detail message, which
   * provides more information about why this exception has been thrown.
   */
  public HTTPException(String msg, int status) {

    // Calls the superclass constructor to construct an Exception
    // with the specified detail message
    super(msg);

    // Initialize instance variables
    this.status = status;
  }

  /**
   * Returns the HTTP status code of the exception.
   */
  public int getStatus() {
    return status;
  } 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?