Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- upc
- 아스키코드
- lombok
- Annotation
- StringBuilder
- Controller
- 항해
- yeouido
- Service
- replace()
- 이행시
- StringBuffer
- 문자열
- 스프링
- java
- 백엔드
- 어노테이션
- Spring
- string
- repository
- 삼행시
- CS
- 자바
- 윤동주
- 개발
- bit
Archives
- Today
- Total
Dev.끄적끈적
HTTP 메시지 이해하기 본문
[HTTP 메시지]
- Client 와 Server 간 Request, Response 는 HTTP 메시지 규약을 따름
- HTTP 메시지는 웹 서비스 개발자(백엔드, 프론트 개발자)에게 매우 중요한 내용!!
- 스프링 MVC 이해를 위한 필수 내용만 학습
1) 메시지 구조
- <aside> 🌐 참고: HTTP 메시지 설명 (MDN Web Docs)
- 시작줄 (start line)
- Response 에선 '상태줄 (status line)' 이라고 부름
- 헤더 (headers)
- 본문 (body)
2) Request 메시지
- 시작줄: API 요청 내용
- GET **naver.com** HTTP/1.1
- 헤더
- "Content type"
- 없음
- HTML <form> 태그로 요청 시
- Content type: application/x-www-form-urlencoded
- AJAX 요청
- Content type: application/json
- "Content type"
- 본문
- GET 요청 시: (보통) 없음
- POST 요청 시: (보통) 사용자가 입력한 폼 데이터
- name=홍길동&age=20
3) Response 메시지
- 상태줄: API 요청 결과 (상태 코드, 상태 텍스트)
- HTTP/1.1 **404** **Not Found**
- 헤더
- "Content type"
- 없음
- Response 본문 내용이 HTML 인 경우
- Content type: text/html
- Response 본문 내용이 JSON 인 경우
- Content type: application/json
- "Location"
Location: <http://localhost:8080/hello.html>
- Redirect 할 페이지 URL
- "Content type"
- 본문
- HTML
- <!DOCTYPE html> <html> <head><title>By @ResponseBody</title></head> <body>Hello, Spring 정적 웹 페이지!!</body> </html>
- JSON
- { "name":"홍길동", "age": 20 }
'Spring' 카테고리의 다른 글
Controller, Service, Repository 역할, 분리 (0) | 2022.03.27 |
---|---|
리팩토링이란? (0) | 2022.03.27 |
IntelliJ Annotation processing 설정 (0) | 2022.03.24 |
Spring 입문 강의 Notion 링크 (0) | 2022.03.23 |
Spring 입문 week1 (0) | 2022.03.18 |