Code example for AbstractHttpClient

Methods: removeRequestInterceptorByClassremoveResponseInterceptorByClass

1
    public void setGzipEncodingEnabled(boolean enabled) {
        if (enabled) {
            httpClient.addRequestInterceptor(new GzipHttpRequestInterceptor());
            httpClient.addResponseInterceptor(new GzipHttpResponseInterceptor());
        } else { 
            httpClient.removeRequestInterceptorByClass(GzipHttpRequestInterceptor.class);
            httpClient.removeResponseInterceptorByClass(GzipHttpResponseInterceptor.class);
        } 
    } 
 
    /** 
     * Enables caching of HTTP responses. This will only enable the in-memory cache. If you also 
     * want to enable the disk cache, see {@link #enableResponseCache(Context, int, long, int, int)} 
     * . 
     *  
     * @param initialCapacity 
     *            the initial element size of the cache 
     * @param expirationInMinutes 
     *            time in minutes after which elements will be purged from the cache 
     * @param maxConcurrentThreads