编程语言 php java

Java Request方法总结

java HTML我帮您 1年前  0次浏览
Java Request方法总结
System.out.println("Protocol: " + request.getProtocol());
System.out.println("Scheme: " + request.getScheme());
System.out.println("Server Name: " + request.getServerName() );
System.out.println("Server Port: " + request.getServerPort());
System.out.println("Protocol: " + request.getProtocol());
System.out.println("Server Info: " + request.getServletContext().getServerInfo());
System.out.println("Remote Addr: " + request.getRemoteAddr());
System.out.println("Remote Host: " + request.getRemoteHost());
System.out.println("Character Encoding: " + request.getCharacterEncoding());
System.out.println("Content Length: " + request.getContentLength());
System.out.println("Content Type: "+ request.getContentType());
System.out.println("Auth Type: " + request.getAuthType());
System.out.println("HTTP Method: " + request.getMethod());
System.out.println("Path Info: " + request.getPathInfo());
System.out.println("Path Trans: " + request.getPathTranslated());
System.out.println("Query String: " + request.getQueryString());
System.out.println("Remote User: " + request.getRemoteUser());
System.out.println("Session Id: " + request.getRequestedSessionId());
System.out.println("Request URI: " + request.getRequestURI());
System.out.println("Servlet Path: " + request.getServletPath());
System.out.println("Accept: " + request.getHeader("Accept"));
System.out.println("Host: " + request.getHeader("Host"));
System.out.println("Referer : " + request.getHeader("Referer"));
System.out.println("Accept-Language : " + request.getHeader("Accept-Language"));
System.out.println("Accept-Encoding : " + request.getHeader("Accept-Encoding"));
System.out.println("User-Agent : " + request.getHeader("User-Agent"));
System.out.println("Connection : " + request.getHeader("Connection"));
System.out.println("Cookie : " + request.getHeader("Cookie"));
System.out.println("Created : " + request.getSession().getCreationTime());
System.out.println("LastAccessed : " + request.getSession().getLastAccessedTime());
输出结果
Protocol: HTTP/1.1
Scheme: http
Server Name: localhost
Server Port: 8080
Protocol: HTTP/1.1
Server Info: Apache Tomcat/7.0.53
Remote Addr: 127.0.0.1
Remote Host: 127.0.0.1
Character Encoding: UTF-8
Content Length: -1
Content Type: null
Auth Type: null
HTTP Method: GET
Path Info: null
Path Trans: null
Query String: null
Remote User: null
Session Id: 943F277D834CEFB0AF47B79461DE3754
Request URI: /test/index.html
Servlet Path: /index.html
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Host: localhost:8080
Referer : http://localhost:8080/test/login.html
Accept-Language : zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding : gzip, deflate
User-Agent : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
Connection : keep-alive
Cookie : JSESSIONID=943F277D834CEFB0AF47B79461DE3754; JSESSIONID=13y76ww3u6c7s1gre555tlwws2; __utma=111872281.806308271.1398232741.1398232741.1398232741.1; __utmz=111872281.1398232741.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmv=111872281.|1=Treatment=A=1
Created : 1400826766423
LastAccessed : 1400827347565




版权所有

发表评论