HttpServletResponse
HttpServletResponse is an interface in the Java Servlet API that represents the HTTP response to be sent to a client. It is provided to servlet methods such as doGet and doPost by the servlet container, which uses it to construct and transmit the response. Implementations are supplied by the web server or container and control how the response is delivered.
The interface exposes methods to control status codes, headers, and the response body. Key operations include
Additional controls include buffering via setBufferSize(int), flushBuffer(), and resetBuffer(); and state management with isCommitted() and reset().
HttpServletResponse is part of javax.servlet.http in older specifications and jakarta.servlet.http in newer ones; the exact package