1
我有幾個「int-http:入站網關」,我需要其中的一個根據請求提供的http方法指向不同的服務。基於Spring集成的REST方法的路由
<int-http:inbound-gateway path="....." supported-methods="POST,PUT"/>
在這一刻我有2點不同的端點和我一直在尋找一些基於REST的方法路由器,但我沒有發現任何有關此主題。
任何幫助?
我有幾個「int-http:入站網關」,我需要其中的一個根據請求提供的http方法指向不同的服務。基於Spring集成的REST方法的路由
<int-http:inbound-gateway path="....." supported-methods="POST,PUT"/>
在這一刻我有2點不同的端點和我一直在尋找一些基於REST的方法路由器,但我沒有發現任何有關此主題。
任何幫助?
由於http方法在消息頭中自動設置,因此您可以使用此頭標值路由器。
像這樣
<int-http:inbound-channel-adapter channel="input.channel"
path="/log" supported-methods="PUT,POST" request-payload-type="java.lang.String"/>
<int:channel id="input.channel"/>
<int:header-value-router input-channel="input.channel" header-name="#{T(org.springframework.integration.http.HttpHeaders).REQUEST_METHOD">
<int:mapping value="PUT" channel="put.input.channel"/>
<int:mapping value="POST" channel="post.input.channel"/>
</int:header-value-router>
希望幫助
作品!謝謝 :) –