作者:一克拉白勺的眼泪 | 来源:互联网 | 2022-01-22 23:22
1.JSP代码 :
代码如下:
<%--
Document : index
Created on : 2009-10-4, 12:45:43
Author : lucifer
--%>
<%@page cOntentType="text/html" pageEncoding="UTF-8"%>
"http://www.w3.org/TR/html4/loose.dtd">
get Scheme:
<%=request.getScheme()%>
get Protocol:
<%=request.getProtocol()%>
get Remote Address:
<%=request.getRemoteAddr()%>
get Remote Host:
<%=request.getRemoteHost()%>
get Server Name:
<%=request.getServerName()%>
get Server Port:
<%=request.getServerPort()%>
get Header:
<%=request.getHeader("User-agent")%>
get Method:
<%=request.getMethod()%>
get Request's URL:
<%=request.getServletPath()%>
get Request URI:
<%=request.getRequestURI()%>
get Request Session ID:
<%=request.getRequestedSessionId()%>
2.输出:
get Scheme: http
get Protocol: HTTP/1.1
get Remote Address: 0:0:0:0:0:0:0:1
get Remote Host: 0:0:0:0:0:0:0:1
get Server Name: localhost
get Server Port: 8084
get Header: Mozilla/5.0 (Windows; U; Windows NT 6.0; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
get Method: GET
get Request's URL: /Requests.jsp
get Request URI: /TestRequest/Requests.jsp
get Request Session ID: 6EF4EB4A3FE39A15EEBD4D46FBD0BA32