首页 文章

Http入站网关:返回HttpStatus

提问于
浏览
3

我've a spring integration http inbound-gateway. I'想在不同的使用情况下返回特定的http状态代码 . Is there any way to specify the httpStatus in the response???

我尝试了 excepion type router where each exception is a specific http status code ,但我没有在文档中找到任何帮助 .

谢谢!

1 回答

  • 7

    用户 <header-enricher/> (或其他方式)将状态置于回复消息的 org.springframework.integration.http.HttpHeaders.STATUS_CODE 标头中 . ( Headers 名称为 "http_statusCode" ,但通常建议使用常量) .

    代码可以是 HttpStatus 对象,也可以是带有要返回的状态代码的Integer / String .

    请打开'Documentation' JIRA问题https://jira.springsource.org/browse/INT

相关问题