HttpServletResponse
Learn HttpServletResponse (Servlet Integration, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Fresher Notes HttpServletResponse is the object you fill to answer a request: status code, headers, cookies and the body. Body writing uses getWriter() for text or getOutputStream() for bytes; you may use only one of the two per response. Status and type are set with setStatus , sendError and setContentType before any body is written.