0
我想将一个api
的对象以及HTTP response
转换为Spring
代码中的另一个。为此,我正在使用rest template
,并且我从中成功获得所需的Object
。如何使用Rest模板在内部启动时获取API在Spring启动时的HTTP状态
但我想要取HTTP response
也分别为api
。 我该怎么做才能做到这一点?
RestTemplate restTemplate = new RestTemplate();
Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
System.out.println("quote "+quote);
System.out.println(quote.getType());
log.info(quote.toString());
类似的问题http://stackoverflow.com/questions/10473067/receive-the-http-status-after-a-request-with-spring-mvc –