骡子 - 如何基于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')更多推荐
发布评论