List of usage examples for java.net CookieManager put
public void put(URI uri, Map<String, List<String>> responseHeaders) throws IOException
From source file:com.exzogeni.dk.http.HttpTask.java
@SuppressWarnings("checkstyle:illegalcatch") private V onSuccessInternal(HttpURLConnection cn) throws Exception { try {/*from w ww. j av a 2 s . c o m*/ final URI uri = getEncodedUriInternal(); final Map<String, List<String>> headers = getHeaderFields(cn); final CookieManager cookieManager = mHttpManager.getCookieManager(); final CacheManager cacheManager = mHttpManager.getCacheManager(); cookieManager.put(uri, headers); final int responseCode = cn.getResponseCode(); InputStream content = getInputStream(cn); if (responseCode == HttpURLConnection.HTTP_OK && mCachePolicy.shouldCache(uri)) { content = cacheManager.put(uri, headers, content); } else if (responseCode == HttpURLConnection.HTTP_NOT_MODIFIED && mCachePolicy.shouldCache(uri)) { content = cacheManager.update(uri, headers); } return onSuccessInternal(responseCode, headers, content); } catch (Exception e) { throw onException(new HttpException(getEncodedUrlInternal(), e)); } }