Package org.apache.shindig.common.uri

Examples of org.apache.shindig.common.uri.UriBuilder.toUri()


    Preconditions.checkNotNull(token, "No token available for social preloads");

    UriBuilder builder = UriBuilder.parse(
        jsonUri.replace("%host%", context.getHost()))
        .addQueryParameter("st", token);
    return builder.toUri();
  }
}
View Full Code Here


        } else {
          UriBuilder uriBuilder = new UriBuilder(request.getUri());
          String query = uriBuilder.getQuery();
          query = query == null ? params : query + '&' + params;
          uriBuilder.setQuery(query);
          request.setUri(uriBuilder.toUri());
        }
      }

      return new Data(requestPipeline.execute(request));
    }
View Full Code Here

        // TODO: Add current url to GadgetContext to support transitive proxying.
        UriBuilder uri = new UriBuilder(view.getHref());
        uri.addQueryParameter("lang", context.getLocale().getLanguage());
        uri.addQueryParameter("country", context.getLocale().getCountry());

        HttpRequest request = new HttpRequest(uri.toUri())
            .setIgnoreCache(context.getIgnoreCache())
            .setOAuthArguments(new OAuthArguments(view))
            .setAuthType(view.getAuthType())
            .setSecurityToken(context.getToken())
            .setContainer(context.getContainer())
View Full Code Here

      public SecurityToken getToken() {
        return new AnonymousSecurityToken();
      }
    });

    pipeline.plainResponses.put(uri.toUri(), new HttpResponse(PROXIED_HTML_CONTENT));
    String content = proxyRenderer.render(gadget);
    assertEquals(PROXIED_HTML_CONTENT, content);
  }

  @Test
View Full Code Here

      builder.addQueryParameter(Param.SANITIZE.getKey(), "1");
    }
    if (src.getRewriteMimeType() != null) {
      builder.addQueryParameter(Param.REWRITE_MIME_TYPE.getKey(), src.getRewriteMimeType());
    }
    return builder.toUri();
  }

  public ProxyUri process(Uri uri) throws GadgetException {
    String proxied = uri.getQueryParameter(Param.URL.getKey());
    ProxyUri proxyUri = new ProxyUri(expectStatus,
View Full Code Here

    uriBuilder.setScheme("http").setAuthority(host).setPath(path);
    uriBuilder.addQueryParameter(Param.URL.getKey(), RESOURCE_1.toString());
    uriBuilder.addQueryParameter("synd", CONTAINER);
    uriBuilder.addQueryParameter(Param.GADGET.getKey(), SPEC_URI.toString());
    uriBuilder.addQueryParameter(Param.REFRESH.getKey(), "321");
    ProxyUriManager.ProxyUri proxyUri = manager.process(uriBuilder.toUri());
    assertEquals(RESOURCE_1, proxyUri.getResource());
    assertEquals(CONTAINER, proxyUri.getContainer());
    assertEquals(SPEC_URI.toString(), proxyUri.getGadget());
    assertEquals(321, (int)proxyUri.getRefresh());
    assertEquals(false, proxyUri.isDebug());
View Full Code Here

          "; only \"http\" and \"https\" supported.", HttpResponse.SC_BAD_REQUEST);
    }
    if (url.getPath() == null || url.getPath().length() == 0) {
      url.setPath("/");
    }
    return url.toUri();
  }

  /**
   * Sets standard forwarding headers on the proxied request.
   * @param inboundRequest
View Full Code Here

    Preconditions.checkNotNull(token, "No token available for social preloads");

    UriBuilder builder = UriBuilder.parse(
        jsonUri.replace("%host%", context.getHost()))
        .addQueryParameter("st", token);
    Uri uri = builder.toUri();
    if(Strings.isNullOrEmpty(uri.getScheme()) && !Strings.isNullOrEmpty(context.getHostSchema())) {
      uri = builder.setScheme(context.getHostSchema()).toUri();
    }
    return uri;
  }
View Full Code Here

        } else {
          UriBuilder uriBuilder = new UriBuilder(request.getUri());
          String query = uriBuilder.getQuery();
          query = query == null ? params : query + '&' + params;
          uriBuilder.setQuery(query);
          request.setUri(uriBuilder.toUri());
        }
      }

      return new Data(requestPipeline.execute(request));
    }
View Full Code Here

    // Query-style syntax. Use path as normal and append query params at the end.
    queryBuilder.addQueryParameter(Param.URL.getKey(), puc.getResource().toString());
    uri.setQuery(queryBuilder.getQuery());
    uri.setPath(path);

    return uri.toUri();
  }

  @SuppressWarnings("deprecation")
  public ProxyUri process(Uri uriIn) throws GadgetException {
    // First determine if the URI is chained-syntax or query-style.
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.