Home > Java > javaTutorial > The difference between HttpServletRequest and ServletRequest

The difference between HttpServletRequest and ServletRequest

巴扎黑
Release: 2016-11-26 09:08:48
Original
1495 people have browsed it

HttpServletRequest and HttpServletResponse are subclasses of ServletRequest and ServletResponse respectively.

The HttpServletRequest interface inherits from ServletRequest and is a more specific abstraction of the Http protocol by ServletRequest.

Servlet can theoretically handle multiple forms of request and response forms, http is just one of them.

ServletRequest is designed for multiple protocols, and the current mainstream is Http protocol.

HttpServletRequest and ServletRequest are both interfaces

HttpServletRequest inherits from ServletRequest

HttpServletRequest has more methods for the Http protocol than ServletRequest.

Such as

getHeader(String name),

getMethod(),

getSession()

and so on.

Their corresponding implementation classes:

javax.servlet.ServletRequestWrapper (implements javax.servlet.ServletRequest)

javax.servlet.http.HttpServletRequestWrapper (implements javax.servlet.http.HttpServletRequest)


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template