Curro
Curro

Reputation: 1411

Http inbound gateway: Return HttpStatus

I've a spring integration http inbound-gateway. I'd like to return specific http status codes in different cases of use. Is there any way to specify the httpStatus in the response???

I tried with a excepion type router where each exception is a specific http status code, but i don't know how to set the status code in the response and I don't find any help about it in the documentation.

Thanks!

Upvotes: 4

Views: 1476

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

User a <header-enricher/> (or other means) to put the status in the org.springframework.integration.http.HttpHeaders.STATUS_CODE header of the reply message. (The header name is "http_statusCode" but using the constant is generally recommended).

The code can either be an HttpStatus object, or an Integer/String with the status code you want to return.

Please open a 'Documentation' JIRA issue https://jira.springsource.org/browse/INT

Upvotes: 7

Related Questions