2014-02-05 82 views
0

我的Web應用程序在以下地址之間的通信:騾子 - Web應用程序和Mule ESB

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

我打電話騾子項目,從Web應用程序(部署在GlassFish),其以下URL中的頁面:

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

Mule項目正在執行遠程服務器上的東西,並返回成功。

我要成功重定向到另一個頁面say

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

When重定向我看到了http://localhost:28146/CallObject地址欄而不是http://localhost:8080/MyProject/page-sucess.html,其次,我無法正確加載CSS和JS。我想我不會處理這個正確

使用以下是騾子流量:

`

<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

有你的騾流設置在成功的情況下重定向報文頭和瀏覽器應遵循的重定向:

<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> 
+0

它拋出錯誤:屬性不允許爲孩子HTTP的元素。 – fatherazrael

+0

我糾正了我的例子。您應該使用set-property元素而不是屬性。 – neildo

+0

它也在Custom Transformer周圍沒有。我想我應該刪除,因爲我無法看到任何用法 – fatherazrael