개념
사용 코드
@PutMapping("/put")
public ResponseEntity<User> put(@RequestBody User user){
return ResponseEntity.status(HttpStatus.CREATED).body(user);
}
public class ResponseEntity<T> extends HttpEntity<T> {
private final Object status;
}
public enum HttpStatus { }
enum 개념
HttpStatus 클래스에서 사용 예시
public enum HttpStatus {
// 1xx Informational
/**
* {@code 100 Continue}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.2.1">HTTP/1.1: Semantics and Content, section 6.2.1</a>
*/
CONTINUE(100, Series.INFORMATIONAL, "Continue"),
/**
* {@code 101 Switching Protocols}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.2.2">HTTP/1.1: Semantics and Content, section 6.2.2</a>
*/
SWITCHING_PROTOCOLS(101, Series.INFORMATIONAL, "Switching Protocols"),
/**
* {@code 102 Processing}.
* @see <a href="https://tools.ietf.org/html/rfc2518#section-10.1">WebDAV</a>
*/
PROCESSING(102, Series.INFORMATIONAL, "Processing"),
/**
* {@code 103 Checkpoint}.
* @see <a href="https://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal">A proposal for supporting
* resumable POST/PUT HTTP requests in HTTP/1.0</a>
*/
CHECKPOINT(103, Series.INFORMATIONAL, "Checkpoint"),
..
}
enum 관련 내용 참고
https://onlyfor-me-blog.tistory.com/420