Does Java HTTP Client handle compression

前端 未结 3 1921
清酒与你
清酒与你 2020-12-20 19:31

I tried to find any mention of handling of compression in new Java HTTP Client but failed. Is there a built-in configuration to handle for e.g. gzip or de

3条回答
  •  半阙折子戏
    2020-12-20 19:50

    No, gzip/deflate compression are not handled by default. You would have to implement that in your application code if you need it - e.g. by providing a customized BodySubscriber to handle it. Alternatively - you may want to have a look at whether some of the reactive stream libraries out there offer such a feature, in which case you might be able to pipe that in by using one of the BodyHandlers.fromSubscriber​(Flow.Subscriber> subscriber) or BodyHandlers.ofPublisher() methods.

提交回复
热议问题