Response Entity 는 ResponseRequest의 Body에 들어갈 객체이다. (ResponseBody와 비슷함)
대신@ResponseBody 에는 없는 " 헤더 " 와 " statusCode " 가 함께 들어간다.
---------------------------------------------------------------------------------------------
ResponseEntity 의 프로퍼티에는
StatusCode
Header
Body 가 들어간다.
---------------------------------------------------------------------------------------------
HOW?
@ResponseMapping( "url " , HttpMethod.GET)
public ResponseEntity<customer> findbyId(@PathVariable int customerId ){
Customer customer= CustomerService.findById( customerId );
HttpHeader header = new HttpHeader();
header.set( " " , " " );
return ResponseEntity<customer>( header, customer , httpStatuscode. OK) ;
}
@ResponseMapping( "url " , HttpMethod.GET)
@ResponseBody
public Customer findById( @PathVariable int customerId){
Customer customer= new Customer();
customer.setName;
customer.setAge;
return customer;
}
'Spring' 카테고리의 다른 글
Servlet Controller 차이 (0) | 2020.01.21 |
---|---|
AJAX (feat json (0) | 2020.01.21 |
MVC 초간단 정리 (0) | 2020.01.18 |
AOP 정리3 (0) | 2020.01.16 |
AOP 핵심비즈니스에 붙일 어노테이션 사용해서 만들기 (0) | 2020.01.16 |