怎样用servlet抓出post、get请求的完整http包内容并输出?如下是用抓包软件抓出来的post包格式,用servlet能获得么?用dopost()?
求指点~~~~~~~~~~~~~~
HTTP - Hyper Text Transfer Protocol
HTTP Command: POST
URI: /xblog/insert.php
HTTP Version: HTTP/1.1<CR><LF>
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*<CR><LF>
Referer: http://192.168.13.216/xblog/creatnew.php?id=4<CR><LF>
Accept-Language: zh-cn<CR><LF>
Content-Type: application/x-www-form-urlencoded<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)<CR><LF>
Host: 192.168.13.216<CR><LF>
Content-Length: 105<CR><LF>
Connection: Keep-Alive<CR><LF>
Cache-Control: no-cache<CR><LF><CR><LF>
Line 1: id=4&author=%D0%FD%C4%BE%C4%BE&title=eee&content=111%3Cscript%3Ealert%28document

解决方案 »

  1.   

    不能,获取的请求路径,请求后面的?问号之后的内容都得不到!request.getRequestURL();
      

  2.   

    http包含头部以及恰多个部分的信息
     
    request中提供了很多getter的方法。。你自己看看他的api获取头部你可以先获取 request.getHeaderNames() 结果集是enumeration 然后你遍历下头部信息中的相关字段数据