Example usage for org.springframework.web.client HttpClientErrorException getRawStatusCode

List of usage examples for org.springframework.web.client HttpClientErrorException getRawStatusCode

Introduction

In this page you can find the example usage for org.springframework.web.client HttpClientErrorException getRawStatusCode.

Prototype

public int getRawStatusCode() 

Source Link

Document

Return the raw HTTP status code value.

Usage

From source file:org.apache.servicecomb.demo.jaxrs.client.CodeFirstRestTemplateJaxrs.java

private void test404(RestTemplate template) {
    HttpClientErrorException exception = null;
    try {/*from ww  w . ja va2  s .  c o m*/
        template.getForEntity("http://127.0.0.1:8080/aPathNotExist", String.class);
    } catch (RestClientException e) {
        if (e instanceof HttpClientErrorException) {
            exception = (HttpClientErrorException) e;
        }
    }
    TestMgr.check(404, exception.getRawStatusCode());
    TestMgr.check("404 Not Found", exception.getMessage());
}