buffer.append("]");
return buffer.toString();
}
protected CxfOperationException populateCxfRsProducerException(Exchange exchange, Response response, int responseCode) {
CxfOperationException exception;
String uri = exchange.getFromEndpoint().getEndpointUri();
String statusText = Response.Status.fromStatusCode(responseCode).toString();
Map<String, String> headers = parseResponseHeaders(response, exchange);
//Get the response detail string
String copy = exchange.getContext().getTypeConverter().convertTo(String.class, response.getEntity());
if (responseCode >= 300 && responseCode < 400) {
String redirectLocation;
if (response.getMetadata().getFirst("Location") != null) {
redirectLocation = response.getMetadata().getFirst("location").toString();
exception = new CxfOperationException(uri, responseCode, statusText, redirectLocation, headers, copy);
} else {
//no redirect location
exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
}
} else {
//internal server error(error code 500)
exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
}
return exception;
}