📄 httpexception.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 + -