com.facebook.internal.CacheableRequestBatch Java Examples

The following examples show how to use com.facebook.internal.CacheableRequestBatch. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphObjectPagingLoader.java    From platform-friends-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #2
Source File: GraphObjectPagingLoader.java    From Klyph with MIT License 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #3
Source File: GraphObjectPagingLoader.java    From FacebookNewsfeedSample-Android with Apache License 2.0 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #4
Source File: GraphObjectPagingLoader.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #5
Source File: GraphObjectPagingLoader.java    From android-skeleton-project with MIT License 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #6
Source File: GraphObjectPagingLoader.java    From HypFacebook with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #7
Source File: GraphObjectPagingLoader.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #8
Source File: BatchRequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testCreateEmptyRequestBatch() {
    CacheableRequestBatch batch = new CacheableRequestBatch();

    Request meRequest = Request.newMeRequest(null, null);
    assertEquals(0, batch.size());
    batch.add(meRequest);
    assertEquals(1, batch.size());
    assertEquals(meRequest, batch.get(0));

    String key = "The Key";
    assertNull(batch.getCacheKeyOverride());
    batch.setCacheKeyOverride(key);
    assertEquals(key, batch.getCacheKeyOverride());

    assertTrue(!batch.getForceRoundTrip());
    batch.setForceRoundTrip(true);
    assertTrue(batch.getForceRoundTrip());
}
 
Example #9
Source File: GraphObjectPagingLoader.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #10
Source File: GraphObjectPagingLoader.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #11
Source File: GraphObjectPagingLoader.java    From Abelana-Android with Apache License 2.0 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #12
Source File: GraphObjectPagingLoader.java    From KlyphMessenger with MIT License 6 votes vote down vote up
public void followNextLink() {
    if (nextRequest != null) {
        appendResults = true;
        currentRequest = nextRequest;

        currentRequest.setCallback(new Request.Callback() {
            @Override
            public void onCompleted(Response response) {
                requestCompleted(response);
            }
        });

        loading = true;
        CacheableRequestBatch batch = putRequestIntoBatch(currentRequest, skipRoundtripIfCached);
        Request.executeBatchAsync(batch);
    }
}
 
Example #13
Source File: GraphObjectPagingLoader.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #14
Source File: GraphObjectPagingLoader.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #15
Source File: GraphObjectPagingLoader.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #16
Source File: GraphObjectPagingLoader.java    From KlyphMessenger with MIT License 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #17
Source File: GraphObjectPagingLoader.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #18
Source File: GraphObjectPagingLoader.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #19
Source File: GraphObjectPagingLoader.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #20
Source File: GraphObjectPagingLoader.java    From android-skeleton-project with MIT License 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #21
Source File: GraphObjectPagingLoader.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #22
Source File: GraphObjectPagingLoader.java    From Klyph with MIT License 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #23
Source File: GraphObjectPagingLoader.java    From platform-friends-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private CacheableRequestBatch putRequestIntoBatch(Request request, boolean skipRoundtripIfCached) {
    // We just use the request URL as the cache key.
    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    // We use the default cache key (request URL).
    batch.setForceRoundTrip(!skipRoundtripIfCached);
    return batch;
}
 
Example #24
Source File: BatchRequestTests.java    From FacebookImageShareIntent with MIT License 4 votes vote down vote up
@MediumTest
@LargeTest
public void testCacheMyFriendsRequest() throws Exception {
    TestUtils.clearFileLruCache(Response.getResponseCache());
    TestSession session = openTestSessionWithSharedUser();

    Request request = Request.newMyFriendsRequest(session, null);

    CacheableRequestBatch batch = new CacheableRequestBatch(request);
    batch.setCacheKeyOverride("MyFriends");

    // Running the request with empty cache should hit the server.
    List<Response> responses = Request.executeBatchAndWait(batch);
    assertNotNull(responses);
    assertEquals(1, responses.size());

    Response response = responses.get(0);
    assertNotNull(response);
    assertNull(response.getError());
    assertTrue(!response.getIsFromCache());

    // Running again should hit the cache.
    responses = Request.executeBatchAndWait(batch);
    assertNotNull(responses);
    assertEquals(1, responses.size());

    response = responses.get(0);
    assertNotNull(response);
    assertNull(response.getError());
    assertTrue(response.getIsFromCache());

    // Forcing roundtrip should hit the server again.
    batch.setForceRoundTrip(true);
    responses = Request.executeBatchAndWait(batch);
    assertNotNull(responses);
    assertEquals(1, responses.size());

    response = responses.get(0);
    assertNotNull(response);
    assertNull(response.getError());
    assertTrue(!response.getIsFromCache());

    TestUtils.clearFileLruCache(Response.getResponseCache());
}