You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
2_서블릿 (1)
프로젝트 생성
Hello 서블릿
스프링 부트 서블릿 환경 구성
@ServletComponentScanhello.servlet.ServletApplication
서블릿 등록하기
실제 동작하는 서블릿 코드를 등록해보자
@WebServlet서블릿 애노테이션protected void service(HttpServletRequest request, HttpServletResponse response)HTTP 요청 메세지 로그로 확인하기
logging.level.org.apache.coyote.http11=trace서블릿 컨테이너 동작 방식 설명
HttpServletRequest - 개요
HttpServletRequest 역할
HttpServletRequest객체에 담아서 제공HttpServletRequest를 사용하면 다음과 같은 HTTP 요청 메세지를 편리하게 조회할 수 있음request.setAttribute(name, value)request.getAttribute(name)request.getSession(create: true)HttpServletRequest - 기본 사용법
HttpServletRequest가 제공하는 기본 기능들을 알아보자
start-line 정보
Header 모든 정보
Header 편리한 조회
기타 정보 (기타정보는 HTTP 메세지의 정보는 아님)
hello.servlet.basic.request.RequestHeaderServlet
HTTP 요청 데이터 - 개요
1. GET - 쿼리 파라미터
2. POST - HTML Form
3. HTTP message body에 데이터를 직접 담아서 요청
HTTP API에서 주로 사용, JSON, XML, TEXT
데이터 형식은 주로 JSON 사용
🔗 출처
All reactions