How to override response header in jersey client

后端 未结 3 1816
盖世英雄少女心
盖世英雄少女心 2020-12-12 02:52

I have a jersey client that I am trying to unmarshall a response entity with. The problem is the remote web service sends back application/octet-stream as the content type s

3条回答
  •  无人及你
    2020-12-12 03:11

    Under Java 8 and Jersey 2 you can do it with a lambda:

    client.register((ClientResponseFilter) (requestContext, responseContext) ->
                    responseContext.getHeaders().putSingle("Content-Type", "application/json"));
    

提交回复
热议问题