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

📄 httpmethod.java

📁 RFC 1945 Http1.0协议实现。对协议进行了完整面向对象设计
💻 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 + -