apache-httpclient-4.xapache-commons-httpclientapache-httpcomponentsapache-httpasyncclient

How to disable compression handling in Apache HttpAsyncClient


When creating a normal CloseableHttpClient I can disable compression (and redirections) by doing

httpclient = HttpClients.custom()
            .disableRedirectHandling()
            .disableContentCompression()
            .build();

This way I receive gzip data unaltered. Now I'm trying the same with CloseableHttpAsyncClient, but the relevant methods are missing from HttpAsyncClients.custom():

asyncHttpClient = HttpAsyncClients.custom()
    .disableContentCompression() // COMPILE ERROR
    .build();

I'm just at the start of evaluating the feasability or rewriting my code to the async API so I might be missing something. How is the async client going to handle compressed content? Can its behavior be customized?


Solution

  • HttpAsyncClient 4.x currently does not support automatic content decompression.