Replies: 1 comment
|
화이팅 !!! ~~~ |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
✏️ HTTP 요청 - 기본, 헤더 조회
@Slf4j는 아래와 같은 코드를 자동으로 생성해서 로그를 선언해준다.log라고 사용하면 된다.✏️ HTTP 요청 파라미터 - 쿼리 파라미터, HTML Form
⭐ 클라이언트에서 서버로 요청 데이터를 전달할 때는 주로 다음 3가지 방법을 사용한다.
🔍 요청 파라미터 - 쿼리 파라미터, HTML Form
HttpServletRequest의request.getParameter()를 사용ㅇ하면 다음 두 가지 요청 파라미터를 조회할 수 있다.GET 쿼리 파라미터 전송 방식이든, POST Html Form 전송 방식이든 둘다 형식이 같으므로 구분없이 조회할 수 있다.
이것을 간단히 요청 파라미터(request parameter) 조회라 한다.
RequestParamController/resources/static아래에 두면 스프링 부트가 자동으로 인식한다.main/resources/static/basic/hello-form.html✏️ HTTP 요청 파라미터 -
@RequestParam@RequestParam을 사용하면 요청 파라미터를 매우 편리하게 사용할 수 있다.🔍
requestparamV2🔍
requestparamV3🔍
requestparamV4🔍 파라미터 필수 여부 -
requestparamRequired🔍 기본 값 적용 -
requestparamDefault🔍 파라미터를 Map 으로 조회하기 -
requestparamMap✏️ HTTP 요청 파라미터 -
@ModelAttribute@ModelAttribute기능을 제공한다.HelloData🔍
@ModelAttribute적용 - modelAttributeV1getUsername(),setUsername()메서드가 있으면, 이 객체는username이라는 프로퍼티를 가지고 있다.username프로퍼티의 값을 변경하면setUsername()이 호출되고, 조회하면getUsername()이 호출된다.🔍
@ModelAttribute생략 - modelAttributeV2✏️ HTTP 요청 메시지 - 단순 텍스트
@RequestParam,@ModelAttribute를 사용할 수 없다.InputStream을 사용해서 직접 읽을 수 있다.🔍
RequestBodyStringController🔍 Input, Output 스트림, Reader - requestBodyStringV2
🔍 HttpEntity - requestBodyStringV3
🔍 RequestBody - reqeustBodyStringV4
@ResponseBody✏️ HTTP 요청 메시지 - JSON
🔍 RequestBodyJsonController
🔍 requestBodyJsonV2 -
@RequestBody문자 변환🔍 requestBodyJsonV3 -
@RequestBody객체 변환@ModelAttribute처럼 한 번에 객체로 변환하기🔍 requestBodyJsonV4 - HttpEntity
🔍 requestBodyJsonV45
🔗출처
All reactions