【发布时间】:2014-11-26 06:08:03
【问题描述】:
我是 Spring 集成的新手,我正在用它开发一个代理。
这是我的配置:
<int-http:inbound-gateway id="testInboundGateway"
supported-methods="GET"
request-channel="test-request"
extract-reply-payload="false"
reply-channel="test-reply"
path="/user/{id}/info"
reply-timeout="50000">
<int-http:header name="id" expression="#pathVariables.id"/>
</int-http:inbound-gateway>
<int-http:outbound-gateway id="testOutboundGateway"
http-method="GET"
request-channel="test-request"
reply-channel="test-process"
url="http://remoteserver/{id}.json"
extract-request-payload="false"
expected-response-type="java.lang.String"
reply-timeout="50000"
charset="UTF-8">
<int-http:uri-variable name="id" expression="headers.id" />
</int-http:outbound-gateway>
<int:service-activator id="activator"
input-channel="test-process"
output-channel="test-reply"
ref="hubBean"
method="process"></int:service-activator>
<bean id="hubBean" class="com.test.testhub.HubService"/>
我的远程服务器返回带有 content-type:application/json;charset=UTF-8 的 JSON
但是我的服务 bean 得到这样的字符串:\u001F \b\u0000\u0000.....
我不知道它是什么。我尝试使用 gzip 对其进行解码,但格式不正确。 所以任何人都可以告诉我如何获得实际结果?
【问题讨论】:
-
你可以使用网络嗅探器(wireshark 或 eclipse 的 tcp/ip 监视器等)来查看实际内容吗?
-
嗨,远程服务器返回整洁的 json,我直接调用它。编码或转换肯定有问题...