String location = clientResult.getHeaders().getFirst("Location");
if (location != null) {
brokerProperties.setLockLocation(location);
}
BrokeredMessage message = new BrokeredMessage(brokerProperties);
MediaType contentType = clientResult.getType();
if (contentType != null) {
message.setContentType(contentType.toString());
}
Date date = clientResult.getResponseDate();
if (date != null) {
message.setDate(date);
}
InputStream body = clientResult.getEntityInputStream();
if (body != null) {
message.setBody(body);
}
for (String key : clientResult.getHeaders().keySet()) {
Object value = clientResult.getHeaders().getFirst(key);
try {
value = customPropertiesMapper.fromString(value.toString());
message.setProperty(key, value);
} catch (ParseException e) {
// log.warn("Unable to parse custom header", e);
} catch (NumberFormatException e) {
// log.warn("Unable to parse custom header", e);
}