Example #1
0
  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();
  }
Example #2
0
  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;
  }