Mar 12, 2023
3 mins read
HTTP ๋ฉ์์ง ์ปจ๋ฒํฐ ์ ์ ๋ฆฌ์์ค๋ ๋ทฐ ํ ํ๋ฆฟ์ ๊ฑฐ์น์ง ์๊ณ , ์ง์ HTTP ์๋ต ๋ฉ์์ง๋ฅผ ์ ๋ฌํ๋ ๊ฒฝ์ฐ HTTP ๋ฉ์์ง ๋ฐ๋์ JSON ๊ฐ์ ํ์์ผ๋ก ๋ฐ์ดํฐ๋ฅผ ์ค์ด ๋ณด๋ธ๋ค. hello.springmvc.basic.response ํจํค์ง์ ResponseBodyController ํด๋์ค ์์ฑ. package hello.springmvc.basic.response; import java.io.IOException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.
Mar 11, 2023
HTTP ์๋ต - HTTP API, ๋ฉ์์ง ๋ฐ๋์ ์ง์ ์ ๋ ฅ ์ ์ ๋ฆฌ์์ค๋ ๋ทฐ ํ ํ๋ฆฟ์ ๊ฑฐ์น์ง ์๊ณ , ์ง์ HTTP ์๋ต ๋ฉ์์ง๋ฅผ ์ ๋ฌํ๋ ๊ฒฝ์ฐ HTTP ๋ฉ์์ง ๋ฐ๋์ JSON ๊ฐ์ ํ์์ผ๋ก ๋ฐ์ดํฐ๋ฅผ ์ค์ด ๋ณด๋ธ๋ค. hello.springmvc.basic.response ํจํค์ง์ ResponseBodyController ํด๋์ค ์์ฑ. package hello.springmvc.basic.response; import java.io.IOException; import org.
Mar 10, 2023
2 mins read
HTTP ์๋ต - ์ ์ ๋ฆฌ์์ค, ๋ทฐ ํ ํ๋ฆฟ ์คํ๋ง(์๋ฒ)์์ ์๋ต ๋ฐ์ดํฐ๋ฅผ ๋ง๋๋ ๋ฐฉ๋ฒ 3๊ฐ์ง ์ ์ ๋ฆฌ์์ค : ์น ๋ธ๋ผ์ฐ์ ์ ์ ์ ์ธ HTML, css, js๋ฅผ ์ ๊ณตํ ๋ ๋ทฐ ํ ํ๋ฆฟ : ์น ๋ธ๋ผ์ฐ์ ์ ๋์ ์ธ HTML์ ์ ๊ณตํ ๋ HTTP ๋ฉ์์ง : HTTP API๋ฅผ ์ ๊ณตํ๋ ๊ฒฝ์ฐ(๋ฐ์ดํฐ๋ฅผ ์ ๋ฌ) HTTP ๋ฉ์์ง ๋ฐ๋์ JSON ๊ฐ์ ํ์์ผ๋ก ์๋ต 1.
Mar 9, 2023
HTTP ์์ฒญ ๋ฉ์์ง - JSON ์ด๋ฒ์๋ HTTP API์์ ์ฃผ๋ก ์ฌ์ฉํ๋ JSON ๋ฐ์ดํฐ ํ์์ ์กฐํํด๋ณด์. package hello.springmvc.basic.request; import java.io.IOException; import java.nio.charset.StandardCharsets; import org.springframework.http.HttpEntity; import org.springframework.stereotype.Controller; import org.springframework.util.StreamUtils; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.fasterxml.jackson.databind.ObjectMapper; import hello.springmvc.basic.HelloData; import jakarta.servlet.ServletInputStream; import jakarta.servlet.http.HttpServletRequest; import jakarta.
Mar 8, 2023
HTTP ์์ฒญ ๋ฉ์์ง - ๋จ์ ํ ์คํธ ํ๋ผ๋ฏธํฐ ํ์(GET์ด๋ POST)๊ฐ ์๋ Http message body์ ๋ฐ์ดํฐ๋ฅผ ์ง์ ๋ด์์ ์์ฒญ์ด ์ค๋ ๊ฒฝ์ฐ๋ฅผ ํ์ธํ๋ค. ์์ฒญ ํ๋ผ๋ฏธํฐ์ ๋ค๋ฅด๊ฒ, HTTP ๋ฉ์์ง ๋ฐ๋๋ฅผ ํตํด ๋ฐ์ดํฐ๊ฐ ์ง์ ๋์ด์ค๋ ๊ฒฝ์ฐ๋ @RequestParam, @ModelAttribute ๋ฅผ ์ฌ์ฉํ ์ ์๋ค. ๋จผ์ ๊ฐ์ฅ ๋จ์ํ ํ ์คํธ ๋ฉ์์ง๋ฅผ HTTP ๋ฉ์์ง ๋ฐ๋์ ๋ด์์ ์ ์กํ๊ณ , ์ฝ์ด๋ณด์.