Тело запроса в этом случае определяется из сообщения запроса payload
:
private HttpEntity<?> generateHttpRequest(Message<?> message, HttpMethod httpMethod) {
Assert.notNull(message, "message must not be null");
return (this.extractPayload) ? this.createHttpEntityFromPayload(message, httpMethod)
: this.createHttpEntityFromMessage(message, httpMethod);
}
Где это createHttpEntityFromPayload()
так:
private HttpEntity<?> createHttpEntityFromPayload(Message<?> message, HttpMethod httpMethod) {
Object payload = message.getPayload();
if (payload instanceof HttpEntity<?>) {
// payload is already an HttpEntity, just return it as-is
return (HttpEntity<?>) payload;
}
HttpHeaders httpHeaders = this.mapHeaders(message);
if (!shouldIncludeRequestBody(httpMethod)) {
return new HttpEntity<>(httpHeaders);
}
// otherwise, we are creating a request with a body and need to deal with the content-type header as well
if (httpHeaders.getContentType() == null) {
MediaType contentType = (payload instanceof String)
? resolveContentType((String) payload, this.charset)
: resolveContentType(payload);
httpHeaders.setContentType(contentType);
}
if (MediaType.APPLICATION_FORM_URLENCODED.equals(httpHeaders.getContentType()) ||
MediaType.MULTIPART_FORM_DATA.equals(httpHeaders.getContentType())) {
if (!(payload instanceof MultiValueMap)) {
payload = this.convertToMultiValueMap((Map<?, ?>) payload);
}
}
return new HttpEntity<>(payload, httpHeaders);
}
Это должно дать вам некоторые идеи, какие payload
вы можете отправить на requestChannel
.