Example usage for org.springframework.web.client HttpServerErrorException getResponseBodyAsByteArray

List of usage examples for org.springframework.web.client HttpServerErrorException getResponseBodyAsByteArray

Introduction

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

Prototype

public byte[] getResponseBodyAsByteArray() 

Source Link

Document

Return the response body as a byte array.

Usage

From source file:io.syndesis.rest.v1.handler.exception.HttpServerErrorExceptionMapper.java

@Override
public Response toResponse(HttpServerErrorException exception) {
    RestError error = new RestError(exception.getMessage(), exception.getMessage(),
            ErrorMap.from(new String(exception.getResponseBodyAsByteArray(), StandardCharsets.UTF_8)),
            exception.getStatusCode().value());
    return Response.status(exception.getStatusCode().value()).type(MediaType.APPLICATION_JSON_TYPE)
            .entity(error).build();//from   w  ww  .java2s  .  c o  m
}