⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpexception.java

📁 一个经典的java的web服务器的建立源代码
💻 JAVA
字号:
// $Id: HTTPException.java,v 1.5 2001/01/11 05:16:27 nconway Exp $
package tornado;

public class HTTPException extends Exception {
    private final int statusCode;

    /** Constructs a new exception with the specified error code.
      * Numeric error codes are specified by the HTTP standard.
      */
    HTTPException(int statusCode) {
        this.statusCode = statusCode;
    }

    /** Returns the error code of this exception.*/
    public int getCode() {
        return statusCode;
    }

    /** Returns the HTML error page that should be shown to the
      * HTTP client.
      */
    public String getErrorPage() {
        StringBuffer page = new StringBuffer(120);
        page.append("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"");
        page.append("<HTML><BODY><H1 ALIGN=CENTER>Error ");
        page.append(statusCode);
        page.append("</H1></BODY></HTML>");
        return page.toString();
    }

}

⌨️ 快捷键说明

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