/******************************************************************************************************************* * * * ******************************************************************************************************************/ @PostConstruct /* VisibleForTesting */ void initialize() { connectionManager = new PoolingHttpClientConnectionManager(); connectionManager.setMaxTotal(200); connectionManager.setDefaultMaxPerRoute(20); cacheConfig = CacheConfig.custom() .setAllow303Caching(true) .setMaxCacheEntries(Integer.MAX_VALUE) .setMaxObjectSize(Integer.MAX_VALUE) .setSharedCache(false) .setHeuristicCachingEnabled(true) .build(); httpClient = CachingHttpClients.custom() .setHttpCacheStorage(cacheStorage) .setCacheConfig(cacheConfig) .setRedirectStrategy(dontFollowRedirect) .setUserAgent("blueMarine (fabrizio.giudici@tidalwave.it)") .setDefaultHeaders(Arrays.asList(new BasicHeader("Accept", "application/n3"))) .setConnectionManager(connectionManager) .addInterceptorFirst(killCacheHeaders) // FIXME: only if explicitly configured .build(); }