HTTP 응답 데이터 - 단순 텍스트, HTML
HTTP 응답 메시지는 주로 다음 내용을 담아서 전달한다.
- 단순 텍스트 응답
- 앞에서 살펴봄(writer.println("ok");)
- HTML 응답
- HTTP API - MessageBody JSON 응답
HTTP ServletResponse- HTML 응답
hello.servlet.web.response.ResponseHtmlServlet
HTTP 응답으로 HTML을 반환할 때는 content-type을 text/html로 지정해야 한다.
실행
- http://localhost:8080/response-html
- 페이지 소스보기를 사용하면 결과 HTML을 확인할 수 있다.