2024年6月13日发(作者:)

httpservletrequest对象详解

公共接口类HttpServletRequest继承自ServletRequest

规定request信息给HTTP servlets

The servlet容器创建了一个HttpServletRequest对象通过他可以使用servlet的方

法(doGet, doPost, etc).

方法摘要:

getAuthType():

Returns the name of the authentication scheme used to protect the servlet

返回证明配置的名字用于保护servlet

getContextPath()

Returns the portion of the request URI that indicates the context of the request.

返回部分请求的URI指出这个请求的上下文关系。

getCookies()

Returns an array containing all of the Cookie objects the client sent with this

request

返回一个数组包含所有的客户端发送的请求cookie对象

getDateHeader( name)

Returns the value of the specified request header as a long value that

represents a Date object

返回指定的请求标头值并用一个长整型描绘这个日期对象。

getHeader( name)

Returns the value of the specified request header as a String.

返回指定的请求头文件为字符型

getHeaderNames()

Returns an enumeration of all the header names this request contains

返回这个请求容器所有头文件名用枚举的方法

getHeaders( name)

Returns all the values of the specified request header as an Enumeration of