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

📄 httprequest.java

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

import java.io.IOException;

import edu.sysu.http.util.HttpGrammarException;

/**
 * @author Administrator
 *
 */
public class HttpRequest extends HttpMessage{
	
	private HttpRequestLine requestLine = new HttpRequestLine();
	/**
	 * 
	 */
	public HttpRequest() {
		// TODO Auto-generated constructor stub
	}
	
	public HttpRequest(String method, String uri)
			throws HttpGrammarException, IOException {
		// TODO Auto-generated constructor stub
		this.requestLine.setMethod(method);
		this.requestLine.setURI(uri);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try {
			HttpRequest req = new HttpRequest("GET", "http://localhost");
			System.out.println(req.toString());
		} catch (HttpGrammarException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void setRequestLine(HttpRequestLine requestLine) {
		this.requestLine = requestLine;
	}

	public HttpRequestLine getRequestLine() {
		return requestLine;
	}
	
	public String toString(){
		return this.requestLine.toString();
	}

}

⌨️ 快捷键说明

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