reading JSON response as string using jersey client

前端 未结 4 982
有刺的猬
有刺的猬 2021-02-20 07:20

I am using jersey client to post a file to a REST URI that returns response as json. My requirement is to read the response as is(json) to a string.

Here is the piece of

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-20 07:45

    I was able to find solution to the problem. Just had to call bufferEntity method before getEntity(String.class). This will return response as string.

       clientResp.bufferEntity();
       String x = clientResp.getEntity(String.class);
    

提交回复
热议问题