HttpServletRequest和ServletRequest的区别.RP
问题:
请问HttpServletRequest和ServletRequest的区别?
回答:
servlet理论上可以处理多种形式的请求响应形式
http只是其中之一
所以HttpServletRequest、 HttpServletResponse分别是ServletRequest和ServletResponse的子类
---------------------------------------------------------------------
参考阅读:
==========
HttpServletRequest和ServletRequest都是接口
HttpServletRequest继承自ServletRequest
HttpServletRequest比ServletRequest多了一些针对于Http协议的方法。
如
getHeader(String name),
getMethod() ,
getSession()
等等。
他们对应的实现类:
javax.servlet.ServletRequestWrapper (implements javax.servlet.ServletRequest)
javax.servlet.http.HttpServletRequestWrapper (implements javax.servlet.http.HttpServletRequest)
------
引自:
http://zhidao.baidu.com/question/21720605.html
http://whoosh.iteye.com/blog/1307518
文轉:http://lixh1986.iteye.com/blog/1765667