根據請求設置正文時,可以使用Jackson而不是JSON-lib和Groovy的HTTPBuilder嗎?Groovy HTTPBuilder和Jackson
實施例:
client.request(method){
uri.path = path
requestContentType = JSON
body = customer
response.success = { HttpResponseDecorator resp, JSONObject returnedUser ->
customer = getMapper().readValue(returnedUser.content[0].toString(), Customer.class)
return customer
}
}
在本例中,我使用的傑克遜精細處理的響應的情況下,但相信該請求正在使用JSON-LIB。
謝謝。我在迴應中做了類似的事情,但我正在談論編組身體。我會更新這個問題。 –
好的,我已經更新了請求中的JSON答案 – ataylor