【问题标题】:How to implement Mule HTTP GET Method redirect?如何实现 Mule HTTP GET 方法重定向?
【发布时间】:2014-08-14 13:43:02
【问题描述】:

我正在尝试将 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>

【问题讨论】:

    标签: http redirect mule


    【解决方案1】:

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

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

    或者您可以通过设置 http 'Location' 标头和 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>
    

    【讨论】:

    • 非常感谢。过去 2 小时我一直在寻求帮助。谢谢!
    • 好的,这个 url 现在变成了 404,并且响应构建已经被贬值了。你是怎么解决这个问题的?
    猜你喜欢
    • 2014-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多