2014年7月11日 星期五

『JSP』取得 HttpRequest Header

參考使用

網址:http://192.168.1.110:8080/Demo/httprequest.jsp?id=abc123#test

request.getProtocol()HTTP/1.1
request.getScheme()http
request.getServerName()192.168.1.110
request.getServerPort()8080
request.getProtocol()HTTP/1.1
getServletConfig()
.getServletContext().getServerInfo()
Apache Tomcat/7.0.53
request.getRemoteAddr()192.168.1.110
request.getRemoteHost()192.168.1.110
request.getCharacterEncoding()null
request.getContentLength()-1
request.getMethod()GET
request.getQueryString()id=abc123
request.getRequestURL()http://192.168.1.110:8080/Demo/httprequest.jsp
request.getRequestURI()/Demo/httprequest.jsp
request.getServletPath()/httprequest.jsp
session.getCreationTime()1405077415920
session.getLastAccessedTime()1405077415920
request.getHeader("Host")192.168.1.110:8080
request.getHeader("Accept-Language")zh-tw
request.getHeader("Accept-Encoding")gzip, deflate
request.getHeader("User-Agent")Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3)
AppleWebKit/537.75.14 (KHTML, like Gecko) Safari/522.0
request.getHeader("Connection")keep-alive

沒有留言:

張貼留言