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

📄 httpresponseexception.java

📁 RFC 1945 Http1.0协议实现。对协议进行了完整面向对象设计
💻 JAVA
字号:
/**
 * 
 */
package edu.sysu.http.util;

/**
 * @author Administrator
 *
 */
public class HttpResponseException extends Exception{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3389874230879895502L;
	private String msg;
	private HttpRegex regex = new HttpRegex("[0-9]{3}");
	/**
	 * 
	 */
	public HttpResponseException() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param msg the msg to set
	 */
	public void setMsg(String msg) throws HttpGrammarException{
		if(this.regex.Match(msg))
			this.msg = msg;
		else
			throw new HttpGrammarException("Message invalid.");
	}
	public HttpResponseException(String msg) {
		try {
			this.setMsg(msg);
		} catch (HttpGrammarException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
	}
	public String getMessage(){
		return this.msg;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		HttpResponseException exp = new HttpResponseException("200");
		System.out.println(exp.getMessage());
	}

}

⌨️ 快捷键说明

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