首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mule基础知识视频不适用于我

Mule基础知识视频不适用于我
EN

Stack Overflow用户
提问于 2015-12-07 12:13:20
回答 1查看 67关注 0票数 0

我已经成功地使用Macbook Pro观看了Mule Fundamentals视频。我现在有Windows10,我正在做同样的事情,但在这种情况下,url/?language=French不工作,即查询参数language=在记录器中显示西班牙语,并且在任何情况下,消息流都会通过西班牙语默认设置的Variable组件运行。

我一遍又一遍地检查了每个组件,但好像message.inboundProperties无法识别变量component #[message.inboundProperties['language']]中的集合变量Language

在每种language=anything情况下,language=Spanish (缺省)和缺省有效负载都是"Hola! Como esa"

这是xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
    <flow name="hellomuleFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <expression-filter expression="#[message.payload != '/favicon.ico']" doc:name="Expression" />
        <set-variable variableName="Language" value="#[message.inboundProperties['language']]" doc:name="Set Language Variable"/>
        <choice doc:name="Choice">
            <when expression="#[flowVars['language']=='Japanese']">
                <set-payload value="Konichiwa" doc:name="Respond in Japanese"/>
            </when>
            <when expression="#[flowVars['language']=='French']">
                <set-payload value="Bonjour" doc:name="Respond in French"/>
            </when>
            <otherwise>
                <set-variable variableName="language" value="Zulu" doc:name="Set Language"/>
                <set-payload value="Hola" doc:name="Respond in Spanish"/>
            </otherwise>
        </choice>
        <logger level="INFO" doc:name="Logger" message="The response &quot;#[message.payload]&quot; means Hello in #[flowVars['language']]"/>
    </flow>
</mule>
EN

回答 1

Stack Overflow用户

发布于 2015-12-08 18:02:06

在设置变量值时进行更正。在设定变量值时,尝试从MEL表达式的header.Change中读取查询参数值,如下所示。在设置变量时将值更改为"#message.inboundProperties.'http.query.params'.language“

希望这能对你有所帮助!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34126326

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档