java jsp的request服务器环境变量


<%
out.println("Protocol: " + request.getProtocol() + "<br>");
out.println("Scheme: " + request.getScheme() + "<br>");
out.println("Server Name: " + request.getServerName() + "<br>" );
out.println("Server Port: " + request.getServerPort() + "<br>");
out.println("Protocol: " + request.getProtocol() + "<br>");
out.println("Server Info: " + getServletConfig().getServletContext().getServerInfo() + "<br>");
out.println("Remote Addr: " + request.getRemoteAddr() + "<br>");
out.println("Remote Host: " + request.getRemoteHost() + "<br>");
out.println("Character Encoding: " + request.getCharacterEncoding() + "<br>");
out.println("Content Length: " + request.getContentLength() + "<br>");
out.println("Content Type: "+ request.getContentType() + "<br>");
out.println("Auth Type: " + request.getAuthType() + "<br>");
out.println("HTTP Method: " + request.getMethod() + "<br>");
out.println("Path Info: " + request.getPathInfo() + "<br>");
out.println("Path Trans: " + request.getPathTranslated() + "<br>");
out.println("Query String: " + request.getQueryString() + "<br>");
out.println("Remote User: " + request.getRemoteUser() + "<br>");
out.println("Session Id: " + request.getRequestedSessionId() + "<br>");
out.println("Request URI: " + request.getRequestURI() + "<br>");
out.println("Servlet Path: " + request.getServletPath() + "<br>");
out.println("Accept: " + request.getHeader("Accept") + "<br>");
out.println("Host: " + request.getHeader("Host") + "<br>"); 
out.println("Referer : " + request.getHeader("Referer") + "<br>"); 
out.println("Accept-Language : " + request.getHeader("Accept-Language") + "<br>"); 
out.println("Accept-Encoding : " + request.getHeader("Accept-Encoding") + "<br>"); 
out.println("User-Agent : " + request.getHeader("User-Agent") + "<br>"); 
out.println("Connection : " + request.getHeader("Connection") + "<br>"); 
out.println("Cookie : " + request.getHeader("Cookie") + "<br>"); 
out.println("Created : " + session.getCreationTime() + "<br>"); 
out.println("LastAccessed : " + session.getLastAccessedTime() + "<br>"); 


%>

结果
Protocol: HTTP/1.1
Scheme: http
Server Name: 172.16.96.251
Server Port: 80
Protocol: HTTP/1.1
Server Info: Resin/2.1.10
Remote Addr: 172.16.95.69
Remote Host: 172.16.95.69
Character Encoding: null
Content Length: -1
Content Type: null
Auth Type: Basic
HTTP Method: GET
Path Info: null
Path Trans: null
Query String: null
Remote User: null
Session Id: aGKD_NgqBC3d
Request URI: /tmp/123.jsp
Servlet Path: /tmp/123.jsp
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Host: 172.16.96.251
Referer : null
Accept-Language : zh-cn
Accept-Encoding : gzip, deflate
User-Agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Connection : Keep-Alive
Cookie : JSESSIONID=aGKD_NgqBC3d
Created : 1193732589340
LastAccessed : 1193735011785


发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据