Servlet有什么方法可以获得HTTP数据报内容的
POST /tj/Login HTTP/1.1 Content-Type: multipart/form-data; boundary=---------------------------7b4a6d158c9 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) Host: 10.108.195.212 Content-Length: 349 Expect: 100-continue Connection: Keep-Alive HTTP/1.1 100 Continue -----------------------------7b4a6d158c9 Content-Disposition: form-data; name="username" 00001 -----------------------------7b4a6d158c9 Content-Disposition: form-data; name="password" 123 -----------------------------7b4a6d158c9 Content-Disposition: form-data; name="submitted" submitted -----------------------------7b4a6d158c9--
我想获得底下那一大串内容(Header可以不要),但是不只是取参,而是包括“-----------------------------7b4a6d158c9Content-Disposition: form-data;”这些东西,不知道可以吗?
BufferedReader breader = new BufferedReader(new InputStreamReader(req.getInputStream()));
String content;
while((content = breader.readLine()) != null)
{
System.out.println(content);
}
这样试试看了。。