Enumeration遍历http请求参数的一个例子

Enumeration<String> paraNames=request.getParameterNames();

for(Enumeration e=paraNames;e.hasMoreElements();){

 

       String thisName=e.nextElement().toString();

       String thisValue=request.getParameter(thisName);

       System.out.println(thisName+"--------------"+thisValue);

 

}

 

getProtocol():获取请求使用的通信协议,如http/1.1等 

getServletPath():获取请求的JSP也面所在的目录。 

getContentLength():获取HTTP请求的长度。 

getMethod():获取表单提交信息的方式,如POST或者GET。 

getHeader(String s):获取请求中头的值。一般来说,S参数可取的头名有accept,referrer、accept-language、content-type、accept-encoding、user-agent、host、cookie等,比如,S取值user-agent将获得用户的浏览器的版本号等信息。 

getHeaderNames():获取头名字的一个枚举。 

getHeaders(String s):获取头的全部值的一个枚举。 

getRemoteAddr():获取客户的IP地址。 

getRemoteHost():获取客户机的名称(如果获取不到,就获取IP地址)。 

getServerName():获取服务器的名称。 

getServePort():获取服务器的端口。 

getPaeameterNames():获取表单提交的信息体部分中name参数值的一个枚举

 





你可能感兴趣的:(enumeration)