use of org.springframework.integration.support.MessageBuilderFactory in project spring-integration by spring-projects.
the class AbstractHttpRequestExecutingMessageHandler method getReply.
protected Object getReply(ResponseEntity<?> httpResponse) {
if (this.expectReply) {
HttpHeaders httpHeaders = httpResponse.getHeaders();
Map<String, Object> headers = this.headerMapper.toHeaders(httpHeaders);
if (this.transferCookies) {
this.doConvertSetCookie(headers);
}
AbstractIntegrationMessageBuilder<?> replyBuilder = null;
MessageBuilderFactory messageBuilderFactory = getMessageBuilderFactory();
if (httpResponse.hasBody()) {
Object responseBody = httpResponse.getBody();
replyBuilder = (responseBody instanceof Message<?>) ? messageBuilderFactory.fromMessage((Message<?>) responseBody) : messageBuilderFactory.withPayload(responseBody);
} else {
replyBuilder = messageBuilderFactory.withPayload(httpResponse);
}
replyBuilder.setHeader(org.springframework.integration.http.HttpHeaders.STATUS_CODE, httpResponse.getStatusCode());
return replyBuilder.copyHeaders(headers);
}
return null;
}
Aggregations