如何实现Mule HTTP GET方法重定向? [英] How to implement Mule HTTP GET Method redirect?
本文介绍了如何实现Mule HTTP GET方法重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将HTTP GET请求重定向到单独的Web服务器。我找不到任何示例代码。我配置mule.xml如下。我认为必须有一个比这更好的方法。有任何想法吗?谢谢。
I'm trying to redirect HTTP GET requests to a seperate web server. I could not find any example code. I configured mule.xml as below. I think there must be a better way than this. Any ideas? thanks.
<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代理的框模式:
Thats a valid pattern but there is also an out of the box pattern for a http proxy:
http://www.mulesoft.org/documentation/display/current/HTTP+Proxy+Pattern
或者你代替你可以通过设置http'位置'标题和30x响应代码让客户端重定向:
Or you instead you can let the client redirect by setting the http 'Location' header and 30x response code:
<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>
这篇关于如何实现Mule HTTP GET方法重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文