From cd256204d01e4497a6a1078efbfd554c67749670 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 16 Sep 2013 15:52:35 +0300 Subject: [PATCH] INT-3075: Note regarding HTTP Status Code JIRA: https://jira.springsource.org/browse/INT-3075 --- src/reference/docbook/http.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/reference/docbook/http.xml b/src/reference/docbook/http.xml index e1ebde4e95..58c32cbc41 100644 --- a/src/reference/docbook/http.xml +++ b/src/reference/docbook/http.xml @@ -156,6 +156,24 @@ In the case of the Outbound Gateway, the reply message produced by the gateway w If transfer-cookies is false, any Set-Cookie header received will remain as Set-Cookie in the reply message, and will be dropped on subsequent sends. + + + Note: Empty Repsonse Bodies + HTTP is a request/response protocol. However the response may not have a body, just headers. + In this case, the HttpRequestExecutingMessageHandler produces + a reply Message with the payload being + an org.springframework.http.HttpEntity, regardless of any + provided expected-response-type. According to the + HTTP RFC Status Code Definitions, + there are many statuses which identify that a response MUST NOT contain a message-body (e.g. 204 No Content). + There are also cases where calls to the same URL might, or might not, return a response body; for example, + the first request to an HTTP resource returns content, but the second does not (e.g. 304 Not Modified). + In all cases, however, the http_statusCode message header is populated. This can be used in some + routing logic after the Http Outbound Gateway. You could also use a + <payload-type-router/> to route messages with an HttpEntity + to a different flow than that used for responses with a body. + +
@@ -291,6 +309,7 @@ In the case of the Outbound Gateway, the reply message produced by the gateway w default http-method is POST, and the default response type is null. With a null response type, the payload of the reply Message would contain the ResponseEntity as long as it's http status is a success (non-successful status codes will throw Exceptions). If you are expecting a different type, such as a String, then provide that fully-qualified class name as shown below. + See also the note about empty response bodies in . Beginning with Spring Integration 2.1 the request-timeout attribute