Spring RestTemplate post response

前端 未结 2 388
醉梦人生
醉梦人生 2020-12-30 01:25

I\'m not familiar with Spring RestTemplate.

But for this project I have to use Spring RestTemplate to send a POST call to consume a rest api.

I\'m using this

2条回答
  •  抹茶落季
    2020-12-30 02:20

    It will be pretty weird if RestTemplate couldn't get the response,as others have suggested. It is simply not true.

    You just use the postForEntity method which returns a

    http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/http/ResponseEntity.html

    And as the documentation suggests, the response entity has the status.

提交回复
热议问题