Post Method
주소 창에 파라미터가 노출되지 않는다
주소 창에 사용자의 요청 사항이 노출 되지 않는다
Get 방식에서는 주소길이 제한이 있지만 POST는 그보다 길게 사용가능(제한존재)'
브라우저가 주소캐시를 하지 못하는 특성이 있다.
Rest API
HTTP-PUT/PACTH Method
Post와 마찬가지로 Body에 데이터가 들어 있으며 ,주로 업데이트에 사용한다.
Rest의 개념
-HTTP 프로토콜에 있는 Method를 활요한 아키텍쳐 스타일이다.
-HTTP Method를 통해서 Resource를 처리한다.
-CRUD를 통한 Resource 조작을 할때 사용한다.
Http Method | 동작 | URL 형태 |
GET | 조회(SELECT*READ) | /user/{id} |
POST | 생성(CREATE) | /user |
PUT | 수정(UPDATE)*CREATE | /user |
DELETE | 삭제(DELETE) | /user/{1} |
package com.example.study.controller;
import com.example.study.model.SearchParam;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api")//주소
public class PostController {
//json,xml, mutlpart-fomr /textplain
//@RequestMapping(method = RequestMethod.POST,path="/postMethod")
@PostMapping("/postMethod") //post 방식 지정
public SearchParam postMethod(@RequestBody SearchParam searchParam){
return searchParam;
}
@PutMapping("/putMethod")
public void put(){
}
@PatchMapping("/PatchMapping")
public void patch(){
}
}
'웹 > Spring' 카테고리의 다른 글
<Spring>JPA (0) | 2020.12.14 |
---|---|
<Spring>Lombok? (0) | 2020.12.14 |
<Spring>HTTP (0) | 2020.12.14 |
<Spring>통신이란? (0) | 2020.12.14 |
Spring 들어가기 전에.. (0) | 2019.11.12 |