http入站网关路径url映射

时间:2014-10-24 03:02:04

标签: spring-mvc spring-integration

我有两个int-http:inbound-gateway with path,如下所述。当我打电话

http://localhost:8080/XYZ/ABCService/query  -- i expected to call http:inbound-gateway with id ="XYZ"

http://localhost:8080/ABCService/query  - i expected to call http:inbound-gateway with id ="default"

但是当我向http://localhost:8080/XYZ/ABCService/query提出请求时,它的不一致性是什么  它正在调用“默认”gateway.i理解它,因为路径/*服务。但我想知道我可以给一些订单或优先级或某种网址映射说总是首先检查“XYZ”然后检查“默认”

我正在使用DispatcherServlet。

<int-http:inbound-gateway id="default"
        path="/*Service/query"
        request-channel="RequestChannel" reply-channel="ResponseChannel"
        supported-methods="POST" reply-timeout="5000" request-payload-type="java.lang.String"
        error-channel="ErrorChannel" mapped-request-headers="xyz-*, HTTP_REQUEST_HEADERS">
    </int-http:inbound-gateway>


    <int-http:inbound-gateway id="XYZ"
        path="/XYZ/*Service/query"
        request-channel="RequestChannel" reply-channel="XYZResponseChannel"
        supported-methods="POST" reply-timeout="5000" request-payload-type="java.lang.String"
        error-channel="ErrorChannel" mapped-request-headers="xyz-*, HTTP_REQUEST_HEADERS">
         <int-http:header name="reply-type" expression="'ABC'" />
    </int-http:inbound-gateway>

   <int:channel id="ResponseChannel">

    </int:channel>


    <int:header-value-router input-channel="ResponseChannel"
        header-name="reply-type">

        <int:mapping value="ABC" channel="XYZResponseChannel" />
    </int:header-value-router>

1 个答案:

答案 0 :(得分:0)

可以详细说明你确定它无法正常工作吗?

我看到两个端点都具有相同的配置。 dfference只在路径中,但所有其他的attrs都是相同的。

这意味着所有与path无关的邮件都会发送到RequestChannel

我刚刚测试过并且eveything运行良好:

<int-http:inbound-gateway path="/*path1" request-channel="path"/>

<int-http:inbound-gateway path="/foo/*path1" request-channel="fooPath"/>