httpmethod.java
来自「使用java实现的RFC1945 http1.0协议。所有面向对象设计严谨按照R」· Java 代码 · 共 59 行
JAVA
59 行
/**
*
*/
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 + =
减小字号Ctrl + -
显示快捷键?