浏览器url如下:http://127.0.01:9091/
在服务器端收到的信息如下:
GET /favicon.ico HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
Host: 127.0.01:9091
Cache-Control: no-cache
读取请求的方法如下:
public void parse(){
StringBuffer request= new StringBuffer(2048);
int i=0;
byte []buffer=new byte[2048];
try {
i=input.read(buffer);
} catch (IOException e) {
e.printStackTrace();
i=-1;
}
for (int j = 0; j < i; j++) {
request.append((char)buffer[j]);
}
System.out.println(request.toString()+"+++++++");
uri=parseUri(request.toString());
}