The response is what goes back to the client. The thing the browser gets, parses, and renders for the user. Typically, you use the response object to get an output stream (usually a Writer) and you use that stream to write the HTML (or some other type of content) that goes back to the client. The response object has other methods besides just the I/O output, though, and we’ll look at some of them in a bit more detail.
Most of the time, you use the Response just to send data back to the client.
You call two methods on the response: setContentType() and getWriter().
After that, you’re simply doing I/O to write HTML (or something else) to the stream.
But you can also use the response to set other headers, send errors, and add cookies.