Example usage for org.springframework.web.client RestClientResponseException getResponseBodyAsString

List of usage examples for org.springframework.web.client RestClientResponseException getResponseBodyAsString

Introduction

In this page you can find the example usage for org.springframework.web.client RestClientResponseException getResponseBodyAsString.

Prototype

public String getResponseBodyAsString() 

Source Link

Document

Return the response body as a string.

Usage

From source file:com.tianjunwei.RestTemplateTest.java

public static void main(String[] args) {

    RestTemplate restTemplate = new RestTemplate();
    try {/*from   w  ww .j  a va 2 s  . co  m*/
        System.err.println(restTemplate.getForObject("http://localhost:8090/product/get.action", String.class));
    } catch (RestClientResponseException e) {
        System.err.println(e.getResponseBodyAsString());
    }

}