如何实现Mule HTTP GET方法重定向?

时间:2014-06-24 10:24:17

标签: http redirect mule

我正在尝试将HTTP GET请求重定向到单独的Web服务器。我找不到任何示例代码。我配置mule.xml如下。我认为必须有一个比这更好的方法。有任何想法吗?感谢。

<flow name="sampleInsert" doc:name="sampleInsert">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" responseTimeout="1"  doc:name="HTTP" path="indb/sampleInsert" >                 
    </http:inbound-endpoint>                
    <logger level="INFO" doc:name="Logger" message="In Time #[server.dateTime]"/>

    <logger level="INFO" doc:name="Logger" message="Out Time #[server.dateTime]"/>
   <http:outbound-endpoint address="http://www.mulesoft.org/" doc:name="HTTP" exchange-pattern="request-response" followRedirects="true" method="GET"/>


</flow>

1 个答案:

答案 0 :(得分:1)

这是一个有效的模式,但http代理也有一个开箱即用的模式:

http://www.mulesoft.org/documentation/display/current/HTTP+Proxy+Pattern

或者您可以通过设置http&#39;位置&#39;来让客户重定向。标题和30x响应代码:

    <flow name="testResponseMove" processingStrategy="synchronous">
        <http:inbound-endpoint address="http://localhost:${port1}/resources/move" exchange-pattern="request-response"/>
        <http:response-builder status="302">
            <http:location value="http://localhost:9090/resources/moved"/>
        </http:response-builder>
        <echo-component/>
    </flow>