저는 Spring RestTemplate에 익숙하지 않습니다.Spring RestTemplate 게시물 응답
그러나이 프로젝트에서 나머지 API를 사용하기 위해 POST 호출을 보내려면 Spring RestTemplate을 사용해야합니다.
이 코드를 사용하고 있습니다 : 이것은 잘 작동
String restCall = restTemplate.postForObject(url+restParm, null, String.class);
.
HTTP 상태 코드 (예 : 200 OK)를 검색하고 싶습니다. 내가 어떻게 할 수 있니? 감사합니다. .
@Sotirios Delimanolis. 좋아, 그럼 내가 뭘 사용해야하니? – Zamboo
내가 게시 한 링크 인 Apache HTTP Components를 확인하십시오. 다음은 예제를 보여줍니다. http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/HttpClient.html 일부는 잃어 버리고 일부는 얻습니다. –
아니면 http://stackoverflow.com/questions/3322381/spring-resttemplate-behavior-when-handling-responses-with-a-status-of-no-content를 살펴보십시오. 자신의'ResponseExtractor'를 구현하고'restTemplate.execute (...) '를 호출하십시오. –