「Spring」httpレスポンスヘッダを指定するサンプル
書式
@RequestMapping(“/関数名")
public ResponseEntity<String>関数名()
使用例
@RequestMapping("/uerCreate")
public ResponseEntity<String>userCreate(){
URI location =xxx;
HttpHeaders resHeaders = new HttpHeaders();
resHeaders.setLocation(location);
resHeaders.set("cftResponse","cftValue");
HttpStatus status = HttpStatus.NOT_FOUND;
return new ResponseEntity<String>("this is a test",resHeaders,status);
}
@RequestMapping("/uerCreate")
public ResponseEntity<String>userCreate(){
URI location =xxx;
HttpHeaders resHeaders = new HttpHeaders();
resHeaders.setLocation(location);
resHeaders.set("cftResponse","cftValue");
HttpStatus status = HttpStatus.NOT_FOUND;
return new ResponseEntity<String>("this is a test",resHeaders,status);
}
@RequestMapping("/uerCreate") public ResponseEntity<String>userCreate(){ URI location =xxx; HttpHeaders resHeaders = new HttpHeaders(); resHeaders.setLocation(location); resHeaders.set("cftResponse","cftValue"); HttpStatus status = HttpStatus.NOT_FOUND; return new ResponseEntity<String>("this is a test",resHeaders,status); }