骡子

编程入门 行业动态 更新时间:2024-10-15 04:18:38
骡子 - 如何基于http响应代码做出选择/何时?(Mule - How to do a choice/when based on http response codes?)

我需要能够根据从http出站端点返回的http响应代码执行某些操作。 例如,如果我得到500错误或302重定向或200.我需要一种方法来评估500,302,200。我知道如何使用Choice-When,但不知道如何使用如何访问响应代码时髦或任何你建议的。

I need to be able to perform certain actions based on the http response code I get back from an http outbound endpoint. For instance if I get a 500 error or a 302 redirect or a 200. I need a way to evaluate the 500, 302, 200. I know how to use Choice-When, but don't know how to access the response code using groovy or whatever you suggest.

最满意答案

您可以在HTTP出站端点之后立即获取具有以下表达式的HTTP响应代码:

#[message.inboundProperties['http.status']]

同样在Groovy脚本中:

message.getInboundProperty('http.status')

You can get the HTTP response code with the following expression right after the HTTP outbound endpoint:

#[message.inboundProperties['http.status']]

Likewise in a Groovy script:

message.getInboundProperty('http.status')

更多推荐

本文发布于:2023-08-02 09:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1373070.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:骡子

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!