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