본문 바로가기
boostcource/boostcourse_web programming

Request / Response -1

by sgyeong 2024. 4. 9.

헤더 정보 읽어 들이기

- 웹 브라우저가 요청정보에 담아서 보내는 header 값을 읽어 들여 브라우저 화면에 출력한다.
- http://localhost:8080/firstweb/header

- package name : examples

- class name : HeaderServlet

- url mappint : /header

 

 

Class name  HeaderServlet의 서블릿을 만들어준다.

 

 

 

URL mappings 값을 header로 변경해주고 Finish

 

 

 

 

 

코드를 작성하고 실행시킨다.

 

 

 

 

실행 결과

 

 

 

 

 

 

 

 

참고 : boostcourse  https://www.boostcourse.org/web316/lecture/254277/?isDesc=false

 

웹 프로그래밍(풀스택)

부스트코스 무료 강의

www.boostcourse.org

 

 

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers

 

HTTP headers - HTTP | MDN

HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored.

developer.mozilla.org

 

'boostcource > boostcourse_web programming' 카테고리의 다른 글

Request, Response -3  (0) 2024.04.09
Request / Response -2  (0) 2024.04.09
HttpServletRequest / HttpServletResponse  (0) 2024.04.09
Servlet 라이프 싸이클-2  (0) 2024.04.08
Servlet 라이프싸이클 -1  (0) 2024.04.08