Hello.
When writing a project, a question on a topic appeared which I didn’t really think about.
And what is the actual difference between Response, ServletResponse, HttpServletResponse?
HttpServletResponse
Extends the ServletResponse interface to provide HTTP-specific functionality in sending a response. For example, HTTP headers and cookies.
It is assumed that the servlet technology is not tied to only http. Although the masses are not known about other “bindings”, even if they exist.
Therefore, a ServletResponse is some abstract response of some abstract Servlet.
And HttpServletResponse is a specific such ServletResponse of a specific HttpServlet.
What kind of Response to this company recorded absolutely not clear. Therefore, we will assume that this word means exactly what it means - any answer / response (of which (anyone) or to something).
As applied to servlets, as classes of existing entities are refined, they are first converted to ServletResponse, and then to HttpServletResponse.
Source: https://ru.stackoverflow.com/questions/539024/
All Articles