Servlet(5)—ServletRequest接口和ServletResponse接口

ServletRequest接口:
使用ServletRequest接口创建对象,用于使客户端请求信息对Servlet可用,创建的对象作为参数传递之Servlet的Service()
ServletRequest接口的方法:
getAttribute(String)
getAttributeNames()
getCharacterEncoding()
setCharacterEncoding(String)
getContentLength()
getContentType()
getInputStream()
getParameter(String)
getParameterNames()
getParameterValues(String)
getParameterMap()
getProtocol()
getScheme()
getServerName()
getServerPort()
getReader()
getRemoteAddr()
getRemoteHost()
setAttribute(String, Object)
removeAttribute(String)
getLocale()
getLocales()
isSecure()
getRequestDispatcher(String)
getRealPath(String)
getRemotePort()
getLocalName()
getLocalAddr()
getLocalPort()
getServletContext()
startAsync()
startAsync(ServletRequest, ServletResponse)
isAsyncStarted()
isAsyncSupported()
getAsyncContext()
getDispatcherType()

ServletResponse接口:

使用ServletResponse接口创建的对象用于向客户端提供响应,创建的对象作为参数传递至Servlet的service()方法,该接口中
方法如下:
getCharacterEncoding()
getContentType()
getOutputStream()
getWriter()
setCharacterEncoding(String)
setContentLength(int)
setContentType(String)
setBufferSize(int)
getBufferSize()
flushBuffer()
resetBuffer()
isCommitted()
reset()
setLocale(Locale)
getLocale()

posted @ 2017-09-19 11:55  滕鹏飞  阅读(231)  评论(0编辑  收藏  举报