Example usage for org.springframework.web.client UnknownHttpStatusCodeException UnknownHttpStatusCodeException

List of usage examples for org.springframework.web.client UnknownHttpStatusCodeException UnknownHttpStatusCodeException

Introduction

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

Prototype

public UnknownHttpStatusCodeException(int rawStatusCode, String statusText,
        @Nullable HttpHeaders responseHeaders, @Nullable byte[] responseBody,
        @Nullable Charset responseCharset) 

Source Link

Document

Construct a new instance of HttpStatusCodeException based on an HttpStatus , status text, and response body content.

Usage

From source file:com.neiljbrown.brighttalk.channels.reportingapi.client.spring.ApiResponseErrorHandler.java

private HttpStatus getHttpStatusCode(ClientHttpResponse response) throws IOException {
    HttpStatus statusCode;/*from  w  w  w. jav  a  2s .  c  o m*/
    try {
        statusCode = response.getStatusCode();
    } catch (IllegalArgumentException ex) {
        throw new UnknownHttpStatusCodeException(response.getRawStatusCode(), response.getStatusText(),
                response.getHeaders(), getResponseBody(response), getCharset(response));
    }
    return statusCode;
}