Mule - Web应用程序和Mule ESB之间的通信

时间:2014-02-05 07:12:33

标签: java mule

我的网络应用程序位于以下地址:

  

http://localhost:8080/MyProject/page-obj.html

我从一个Web应用程序(部署在glassfish上)调用Mule Project,在页面中有以下URL:

`<form action="http://localhost:28146/CallObject" method="post" id="objform">`

Mule项目正在远程服务器上执行某些操作并返回Success。

我想将成功重定向到另一个页面

  

http://localhost:8080/MyProject/page-sucess.html

重定向时,我在地址栏上看到http://localhost:28146/CallObject,而不是http://localhost:8080/MyProject/page-sucess.html。其次,我无法正确加载CSS和JS。我想我没有正确处理这个问题

以下是使用的Mule Flow:

`

<http:endpoint exchange-pattern="request-response" address="http://localhost:8080/MyProject/page-sucess.html" name="page" method="POST"/>

    <flow name="Create_Work_Flow" doc:name="Create_Work_Flow">
         <http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:28146/CallObject" contentType="text/html" doc:name="Request">
            <http:body-to-parameter-map-transformer doc:name="HTMLForm-Parameters-To-Mule"/>
        </http:inbound-endpoint>
        <logger level="INFO" doc:name="Form-Parameters"  message="#[payload]" />

        <http:outbound-endpoint exchange-pattern="request-response" method="POST" doc:name="HTTP" ref="Page">
            <custom-transformer class="com.ExecuteWorkflow" doc:name="Call-CreateWorkflow"/>
        </http:outbound-endpoint>

    </flow>`

1 个答案:

答案 0 :(得分:1)

在成功案例中让您的Mule流设置重定向标头,浏览器应遵循重定向:

<flow name="Create_Work_Flow" doc:name="Create_Work_Flow">
     <http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:28146/CallObject" contentType="text/html" doc:name="Request">
        <http:body-to-parameter-map-transformer doc:name="HTMLForm-Parameters-To-Mule"/>
    </http:inbound-endpoint>
    <logger level="INFO" doc:name="Form-Parameters"  message="#[payload]" />
    <http:outbound-endpoint exchange-pattern="request-response" method="POST" doc:name="HTTP" ref="Page">
        <custom-transformer class="com.ExecuteWorkflow" doc:name="Call-CreateWorkflow"/>
    </http:outbound-endpoint>
    <set-property propertyName="http.status" value="301"/>
    <set-property propertyName="Location" value="http://localhost:8080/MyProject/page-
</flow>