简体   繁体   English

从骆驼请求中读取正文

[英]Read body as it is from Camel request

i am getting a request via camel route.我通过骆驼路线收到请求。 i need to validate the request against a X.509 Certificate.我需要根据 X.509 证书验证请求。 I need to use request body in signature data.我需要在签名数据中使用请求正文。

The problem is, when i read the request body as string, the format is getting changed.问题是,当我将请求正文作为字符串读取时,格式正在发生变化。

        String reqBody=exchange.getIn().getBody(String.class);

The postman request body sent like below in JSON format postman 请求正文以 JSON 格式发送,如下所示

{"channel_id":"channel test"}

the body received at server side is服务器端收到的正文是

{"channel_id"="channel test"}

Due to change in format, my x509 validation is failing.由于格式更改,我的 x509 验证失败。 How to read the body string as it is from an camel exchange?如何从骆驼交换中读取正文字符串? I can not convert to POJO and use toString() as the format is very sensitive, wanted to read as is.我无法转换为 POJO 并使用 toString() 因为格式非常敏感,想按原样阅读。 Any help appreciated任何帮助表示赞赏

The binding mode changed to dataformat pretty text.绑定模式更改为数据格式漂亮文本。 This worked这有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM