http入站网关路径url映射 [英] http inbound gateway path url mapping

查看:24
本文介绍了http入站网关路径url映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 int-http:inbound-gateway,路径如下所述.当我打电话时

i have two int-http:inbound-gateway with path as mentioned below.when i call

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 发出请求时,它的不一致发生了什么它正在调用默认"网关.我理解它是因为路径/*Serivce.但我想知道我可以给出一些顺序或优先级或某种 url 映射来说总是先检查XYZ"然后检查默认"

but what happing in its not consistence when i give request to http://localhost:8080/XYZ/ABCService/query it is calling "default" gateway.i understand it because of the path /*Serivce.But i like to know can i give some order or priority or some kind of url mapping to say always check "XYZ" first then check "default"

我正在使用 DispatcherServlet.

I am using 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>

推荐答案

能否详细说明你真的确定它不能正常工作?

Can elaborate that you really sure that it doesn't work properly?

我看到您的两个端点具有相同的配置.差异仅在路径中,但所有其他属性都相同.

What I see that both your endpoints have the same config. The dfference is only in the path, but all other attrs are the same.

这意味着所有与 path 无关的消息都将发送到 RequestChannel.

That means that all your messages independently of path will be send to the RequestChannel.

我刚刚测试过,一切正常:

I've just tested and eveything works well:

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

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

这篇关于http入站网关路径url映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆