获取HttpServletRequest请求信息,HTTP协议信息

web开发作者:dayu日期:10天前点击:5

  

请求URL:

http://localhost:8888/dispense/dispense?name=codingme.net

输出:

req.getMethod():GET
req.getContextPath():/dispense
req.getRequestURL():http://localhost:8888/dispense/dispense
req.getRequestURI():/dispense/dispense
req.getQueryString():name=codingme.net
req.getHeader("user-Agent"):Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3080.5 Safari/537.36
--------------------------------------------------------
host:localhost:8888
connection:keep-alive
cache-control:max-age=0
upgrade-insecure-requests:1
user-agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3080.5 Safari/537.36
accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
accept-encoding:gzip, deflate, br
accept-language:zh-CN,zh;q=0.8
cookie:_ga=GA1.1.1003706294.1499565784; Hm_lvt_57ccbd5c600ed4e6bdb9458e666b6409=1499849256,1499853602,1499950574; Hm_lvt_1b51c3ea9a3e7b1a2bc55df97ab4efd3=1499952403
----------------------------------------------------------
req.getHeader("accept"):text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
req.getHeader("host"):localhost:8888

 

原文地址:http://blog.codingme.net/post/servlet-HttpServletRequest-http-info

获取HttpServletRequest请求信息,HTTP协议信息

原文地址:http://www.cnblogs.com/niumoo/p/7227140.html


下一篇       上一篇