Java Request方法总结
public java.lang.Object getAttribute()返回name制定的属性值,若name不存在返回null
public java.util.Enumeration getAttributeNames()
返回request对象所有属性的名字集合
public void setAttribute(String name,Object value)
返回该请求中的一个属性(属性的名字,属性的取值)
能够取得参数的方法
String getParameter(String name) 取得name的参数值
Enumeration getParameterNames() 取得所有的参数名字
String[] getParameterValues(*STring name) 取得所有name的参数值
Map getParameterMap() 取得一个要求参数的map
能够取得请求http标头的方法
String getHeader(String name) 取得name的标头
Enumeration getHeaderNames() 取得所有的标头名称
Enumeration getHeaders(String name) 取得所有name的标头
int getIntHeader(String name) 取得整数类型name的标头
long getDateHeader(String name) 取得日期类型的name的标头
Cookie[] getCookies() 取得与请求有关的cookies
其他方法
String getContextPath() 取得Context路径(即后台名称)
String getMethod() 取得http的方法
String getProtocol() 取得使用的协议
String getQueryString() 取得请求的参数字符串必须为(get)
String getRequestedSessionId() 取得客户端SessionID
String getRequestURI() 取得请求URL,不包括请求参数字符串
String getRemoteAddr() 取得用户ip地址
String getRemoteHost() 取得用户主机名称
int getRemotePort() 取得用户主机端口
String getRemoteUser() 取得用户名称
void etCharacterEncoding(String encoding) 设定编码格式,用来解决窗体传递
Java Request方法总结
=========================================
Protocol: HTTP/1.1
Scheme: http
Server Name: localhost
Server Port: 8080
Protocol: HTTP/1.1
Server Info: Apache Tomcat/6.0.10
Remote Addr: 127.0.0.1
Remote Host: 127.0.0.1
Character Encoding: null
Content Length: 2676
Content Type: multipart/form-da
Auth Type: null
HTTP Method: POST
Path Info: null
Path Trans: null
Query String: null
Remote User: null
Session Id: D6A3440E9AE430D4D4C64D3A
Request URI: /Struts2.5/pro.jsp
Servlet Path: /pro.jsp
Accept: */*
Host: localhost:8080
Referer : http://localhost:8080/Struts2.5/
Accept-Language : zh-cn
Accept-Encoding : gzip, deflate
User-Agent : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; CIBA)
Connection : Keep-Alive
Cookie : JSESSIONID=D6A3440E9AE430D4D4C64D3A
Created : 1271739994968
LastAccessed : 1271739994968