東南西北風

生活就像一杯加了糖的苦咖啡。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

接口HttpServletRequest中的函数说明

Posted on 2009-03-27 13:51  东南西北风  阅读(578)  评论(0)    收藏  举报

当前的地址信息是:http://127.0.0.1:8080/FirstMyEcilpse/servlet/ContextServlet

1.协议

getMethod()-----GET
getProtocol()---HTTP/1.1
getScheme()-----http
2.客户信息

getRemoteAddr()---127.0.0.1
getRemoteHost()---127.0.0.1
getRemotePort()---1843
getRemoteUser()---null

3.请求URL
getContextPath()------/FirstMyEcilpse
getPathInfo()---------null
getPathTranslated()---null
getQueryString()------null
getRequestURI()-------/FirstMyEcilpse/servlet/ContextServlet
getRequestURL()-------http://127.0.0.1:8080/FirstMyEcilpse/servlet/ContextServlet
getServletPath()------/servlet/ContextServlet
getRealPath()---------D:\Java\Tomcat\apache-tomcat-6.0.14\webapps\FirstMyEcilpse\

4、头
getDateHeader()
getHeader()
getHeaderNames()
getHeaders()
getIntHeader()

5、Cookie
getCookie()

6、会话
getRequestSessoinId()
getSession()
isRequestedSessionIdFromCookie()
isRequestedSessionIdFromURL()
isRequestedSessionIdValid()

7、安全
getAuthType()
getRemoteUser()
getUserPrincipal()
isUserInRole()
isSecure()

8、国际化
getCharacterEncoding()
getLocale()
getLocals()
setCharacterEncoding()

9、输入数据
getContentLength()
getContentType()
getInputStream()
getParameter()
getParameterMap()
getParameterNames()
getParameterValues()
getReader()

10、服务器信息
getRequestDispatcher()
getServerName()
getServerPort()

11、属性
getAttribute()
getAttributeNames()
removeAttribute()
setAttribute()

Code