【发布时间】:2014-09-08 22:28:38
【问题描述】:
程序只是读取表格头部并停止。
//...
Socket client = server.accept();
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
System.out.println("Request:");
while ((line = in.readLine()) != null)
if (line.length() > 0)
System.out.println("\t" + line);
else break;
in.close();
client.close();
当我尝试在浏览器上提交一些表单时:
等待请求... 已接受连接。 要求: POST /form.php HTTP/1.1 主持人:x-x-x-x 连接:保持活动 内容长度:31 缓存控制:max-age=0 接受:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 来源:http://neviat.us.to 用户代理:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 内容类型:application/x-www-form-urlencoded 参考:http://x-x-x-x 接受编码:gzip、deflate、sdch 接受语言:pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4 连接关闭。我收到了Content-Length,但对内容本身一无所知。 ¬¬
我认为那可能是else break;,所以我把它取下来又试了一次:
但内容也不存在。
我怎样才能得到它?
【问题讨论】:
标签: java http post httprequest