📄 httpmethod.java
字号:
/**
*
*/
package edu.sysu.http.impl;
import edu.sysu.http.util.HttpGrammarException;
import edu.sysu.http.util.HttpRegex;
/**
* @author Administrator
*
*/
public class HttpMethod {
private String method;
private HttpRegex regex = new HttpRegex();
/**
*
*/
public HttpMethod() {
// TODO Auto-generated constructor stub
this.regex.SetPattern("GET|HEAD|POST");
}
public HttpMethod(String method) throws HttpGrammarException{
this();
this.setMethod(method);
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
/**
* @param method the method to set
*/
public void setMethod(String method) throws HttpGrammarException{
if(this.regex.Match(method))
this.method = method;
else
throw new HttpGrammarException("Method-name invalid.");
}
/**
* @return the method
*/
public String getMethod() {
return method;
}
public String toString(){
return this.method;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -