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