gpt4 book ai didi

java - 使用 Apache Camel 处理 JSON 请求

转载 作者:行者123 更新时间:2023-11-29 07:36:45 24 4
gpt4 key购买 nike

我想处理第 3 方对我的系统所做的 HTTPs 请求。请求包含一个 JSON 对象

我尝试使用 Camel 的 Jetty 组件,但是当第 3 方执行请求时,Camel 抛出以下异常:

org.apache.camel.RuntimeCamelException: Cannot read request parameters due Invalid parameter, expected to be a pair but was {"id":"321","rec":"533","status":"ok"}

Jetty 端点在蓝图中定义为:

<camel:endpoint id="getRequestEndpoint" uri="jetty:{{webServiceProtocol}}://{{jettyIp}}:{{jettyPort}}/getRequest?sslContextParametersRef=sslContextParameters"/>

我是不是遗漏了什么或者走错了路?

最佳答案

确保您的客户端正在为 JSON 发送适当的 Content-Type HTTP 请求 header ,即:

Content-Type: application/json

看起来它没有发送,Jetty 组件回退以形成数据解释。

关于java - 使用 Apache Camel 处理 JSON 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34771635/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com