コード例 #1
0
ファイル: RestUtils.java プロジェクト: rlxrlxrlx/rest.li
  private static String buildPaginatedUri(
      final URI requestUri, final int start, final Integer count) {
    UriBuilder builder = UriBuilder.fromUri(requestUri);
    builder.replaceQueryParam("start", String.valueOf(start));
    builder.replaceQueryParam("count", String.valueOf(count));

    return builder.build().toString();
  }
コード例 #2
0
ファイル: RewriteClient.java プロジェクト: hxgong/rest.li
  private URI rewriteUri(URI uri) {
    assert _serviceName.equals(LoadBalancerUtil.getServiceNameFromUri(uri));

    String path = LoadBalancerUtil.getRawPathFromUri(uri);

    UriBuilder builder = UriBuilder.fromUri(_uri);
    if (path != null) {
      builder.path(path);
    }
    builder.replaceQuery(uri.getRawQuery());
    builder.fragment(uri.getRawFragment());
    URI rewrittenUri = builder.build();

    debug(_log, "rewrite uri ", uri, " -> ", rewrittenUri);

    return rewrittenUri;
  }