Package org.apache.shindig.gadgets.http

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


  @Test(expected=RuntimeException.class)
  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

  @Test(expected=RuntimeException.class)
  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

  @Test(expected=RuntimeException.class)
  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

  @Test(expected=RuntimeException.class)
  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

  @Test(expected=RuntimeException.class)
  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

    final Provider<OAuth2Message> oauth2MessageProvider = EasyMock.createMock(Provider.class);
    final List<ClientAuthenticationHandler> clientAuthenticationHandlers = EasyMock
        .createMock(List.class);
    final List<TokenEndpointResponseHandler> tokenEndpointResponseHandlers = EasyMock
        .createMock(List.class);
    final HttpFetcher fetcher = EasyMock.createMock(HttpFetcher.class);

    EasyMock.replay(oauth2MessageProvider);
    EasyMock.replay(clientAuthenticationHandlers);
    EasyMock.replay(tokenEndpointResponseHandlers);
    EasyMock.replay(fetcher);
View Full Code Here

  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

            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

  @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

TOP

Related Classes of org.apache.shindig.gadgets.http.HttpFetcher

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.