在我第一步與Mule我正在寫一個基本的Http代理。 目前我將請求轉發給api服務器,我想要做的是在響應客戶端之前閱讀從它接收到的有效負載。如何將org.glassfish.grizzly.utils.BufferInputStream轉換爲Mule中的JSON?
當我試着使用#記錄它[有效載荷]它打印
[email protected]
我怎樣才能正確地打印在JSON格式?
的完整代碼:
<flow name="proxy">
<http:listener config-ref="http-lc-0.0.0.0-8081" path="![p['proxy.path']]" parseRequest="false"/>
<http:request config-ref="http-request-config" method="#[message.inboundProperties['http.method']]"
path="#[message.inboundProperties['http.request.path'].substring(message.inboundProperties['http.listener.path'].length()-2)]" parseResponse="false">
<http:request-builder>
<http:query-params expression="#[message.inboundProperties.'http.query.params']"/>
</http:request-builder>
<http:success-status-code-validator values="0..599" />
</http:request>
<logger doc:name="Logger" level="INFO" message="Payload #[payload]"/>