Examples of HttpFetcher


Examples of org.apache.shindig.gadgets.http.HttpFetcher

  public void setTrustedParam(String name, String value) {
    trustedParams.put(name, value);
  }

  private OAuthRequest createRequest() {
    HttpFetcher dest = serviceProvider;
    if (nextFetcher != null) {
      dest = nextFetcher;
    }
    if (trustedParams != null) {
      List<Parameter> trusted = Lists.newArrayList();
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

            entryList)));
        break;
    }
    request.setMethod(method);

    HttpFetcher fetcher = new BasicHttpFetcher();
    HttpResponse response = fetcher.fetch(request);

    System.out.println("Request ------------------------------");
    System.out.println(request.toString());
    System.out.println("Response -----------------------------");
    System.out.println(response.toString());
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test
  public void testGetTamperedRawContent() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("yo momma".getBytes());
        return serviceProvider.fetch(request);
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test
  public void testGetTamperedFormContent() throws Exception {
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("foo=quux".getBytes());
        return serviceProvider.fetch(request);
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test
  public void testGetTamperedRemoveRawContent() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
        return serviceProvider.fetch(request);
      }
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test
  public void testPostTamperedRawContent() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("yo momma".getBytes());
        return serviceProvider.fetch(request);
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test
  public void testPostTamperedFormContent() throws Exception {
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody("foo=quux".getBytes());
        return serviceProvider.fetch(request);
      }
    });
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

  @Test
  public void testPostTamperedRemoveRawContent() throws Exception {
    byte[] raw = { 0, 1, 2, 3, 4, 5 };
    MakeRequestClient client = makeSignedFetchClient("o", "v", "http://www.example.com/app");
    // Tamper with the body before it hits the service provider
    client.setNextFetcher(new HttpFetcher() {
      public HttpResponse fetch(HttpRequest request) throws GadgetException {
        request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
        request.setHeader("Content-Type", "application/x-www-form-urlencoded");
        return serviceProvider.fetch(request);
      }
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

    assertEquals(FILE_JS, lib.getContent());
    assertEquals(UNCOMPRESSED_FILE_JS, lib.getDebugContent());
  }

  public void testUrl() throws Exception {
    HttpFetcher mockFetcher = mock(HttpFetcher.class);
    Uri location = Uri.parse("http://example.org/file.js");
    HttpRequest request = new HttpRequest(location);
    HttpResponse response = new HttpResponseBuilder()
        .setResponse(URL_JS.getBytes())
        .create();
    expect(mockFetcher.fetch(eq(request))).andReturn(response);
    replay();
    JsLibrary lib = JsLibrary.create(
        JsLibrary.Type.URL, location.toString(), null, mockFetcher);
    verify();
View Full Code Here

Examples of org.apache.shindig.gadgets.http.HttpFetcher

            entryList)));
        break;
    }
    request.setMethod(method);

    HttpFetcher fetcher = new BasicHttpFetcher();
    HttpResponse response = fetcher.fetch(request);

    System.out.println("Request ------------------------------");
    System.out.println(request.toString());
    System.out.println("Response -----------------------------");
    System.out.println(response.toString());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.