"Redirecting into HTML page"

"Redirecting into HTML page"

我有一个流程,如果成功登录或失败,我会尝试加载 HTML 页面。 Flow 正在运行,但在浏览器端执行 POST 作业时,它不会重定向到 loginSuccessful.html 或 login/loginFailure.html。

<flow name="GetLoginPage">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/login" allowedMethods="GET" doc:name="HTTP"/>
    <parse-template location="login/index.html" doc:name="Parse Template"/>
</flow>
<flow name="Dologin">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/login" allowedMethods="POST" doc:name="HTTP"/>
    <logger message="trying to login!!!!!!!!!!!" level="INFO" doc:name="Logger"/>
    <choice doc:name="Choice">
        <when expression="#[payload.username == &quot;mule&quot; and payload.password == &quot;mule&quot;]">
            <logger message="login successfully!!!!!!!!!!!" level="INFO" doc:name="Logger"/>
            <parse-template location="login/loginSuccessful.html" doc:name="Parse Template"/>
        </when>
        <otherwise>
            <logger message="login failed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" level="INFO" doc:name="Logger"/>
            <parse-template location="login/loginFailure.html" doc:name="Parse Template"/>
        </otherwise>
    </choice>
</flow>

我冒昧地在 JSON 中创建了我自己的有效载荷并添加了上面的有效载荷值:

{
"name": "mule",
"password": "mule"
}

然后,添加了一个从 JSON 到 Java 的数据转换器,然后我稍微调整了你的条件测试以消除编码引号并将它们替换为单引号:

payload.username == 'mule' and  payload.password == 'mule'

并且选择路由器正确地使用解析模板获取我的测试文件。