Package org.apache.http.client.cache

Examples of org.apache.http.client.cache.CacheResponseStatus


        // This will fetch from backend.
        requestException = sendRequest(client, localContext,urlToCall,null);
        assertNull(requestException);

        CacheResponseStatus responseStatus = (CacheResponseStatus) localContext.getAttribute(HttpCacheContext.CACHE_RESPONSE_STATUS);
        assertEquals(CacheResponseStatus.CACHE_MISS,responseStatus);

        try {
            Thread.sleep(1000);
        } catch (final Exception e) {
View Full Code Here


        // This will fetch from backend.
        requestException = sendRequest(client, localContext,urlToCall,null);
        assertNull(requestException);

        CacheResponseStatus responseStatus = (CacheResponseStatus) localContext.getAttribute(HttpCacheContext.CACHE_RESPONSE_STATUS);
        assertEquals(CacheResponseStatus.CACHE_MISS,responseStatus);

        try {
            Thread.sleep(1000);
        } catch (final Exception e) {
View Full Code Here

        // This will fetch from backend.
        requestException = sendRequest(client, localContext,urlToCall,null);
        assertNull(requestException);

        CacheResponseStatus responseStatus = (CacheResponseStatus) localContext.getAttribute(HttpCacheContext.CACHE_RESPONSE_STATUS);
        assertEquals(CacheResponseStatus.CACHE_MISS,responseStatus);

        try {
            Thread.sleep(1000);
        } catch (final Exception e) {
View Full Code Here

            task.resetProgress();
            task.updateMessage("retrieving response");
            if (response.getEntity() != null) {
                boolean cachedResponse;
                if (context != null) {
                    CacheResponseStatus cacheRespStatus = (CacheResponseStatus) context.getAttribute(CachingHttpClient.CACHE_RESPONSE_STATUS);
                    // To report download progress, the entity is wrapped in a MonitoredHttpEntity.
                    cachedResponse = cacheRespStatus != null && cacheRespStatus != CacheResponseStatus.CACHE_MISS;
                } else {
                    cachedResponse = false;
                }
View Full Code Here

        final HttpResponse respo = client.execute(get, localContext);
        EntityUtils.consume(respo.getEntity());

        // Check cache status
        // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/caching.html
        final CacheResponseStatus responseStatus = (CacheResponseStatus) localContext
                .getAttribute(CachingHttpClient.CACHE_RESPONSE_STATUS);
        assertFalse(CacheResponseStatus.CACHE_MISS.equals(responseStatus));
    }
View Full Code Here

        final HttpResponse respo = client.execute(get, localContext);
        EntityUtils.consume(respo.getEntity());

        // Check cache status
        // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/caching.html
        final CacheResponseStatus responseStatus = (CacheResponseStatus) localContext
                .getAttribute(CachingHttpClient.CACHE_RESPONSE_STATUS);
        assertFalse(CacheResponseStatus.CACHE_MISS.equals(responseStatus));
    }
View Full Code Here

TOP

Related Classes of org.apache.http.client.cache.CacheResponseStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.