public String parse(InputStream in){
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String filename = null;
try {
String httpMessage = br.readLine();
String[] content = httpMessage.split("");
System.out.println("code: "+content[0]+",filename:"+content[1]+",version:"+content[2]);
in对象用来接受Socket.getInputStream(),就是浏览器传过来的信息;
比如我在流浪器中输入 http://localhost:8004/Test71501.html 最后的输出是什么呢?
在这里使用split("")来拆分对不对呢?
请教了;谢谢大家
你还是先打印下httpMessage看是啥吧。
我开始以为浏览器传过来的就是http://localhost:8004/Test71501.html 呢!