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

            "; only \"http\" and \"https\" supported.", HttpResponse.SC_BAD_REQUEST);
      }
      if (url.getPath() == null || url.getPath().length() == 0) {
        url.setPath("/");
      }
      return url.toUri();
    } catch (IllegalArgumentException e) {
      throw new GadgetException(GadgetException.Code.INVALID_PARAMETER,
          "url parameter is not a valid url: " + urlToValidate, HttpResponse.SC_BAD_REQUEST);
    }
  }
View Full Code Here

    uri.addQueryParameter(Param.URL.getKey(), SPEC_URI.toString());
    uri.addQueryParameter(Param.CONTAINER.getKey(), CONTAINER);
    if (version != null) {
      uri.addQueryParameter(Param.VERSION.getKey(), version);
    }
    return uri.toUri();
  }
 
  // Used for "feature-focused" tests, eg. security token and locked domain
  private Gadget mockGadget(String... features) {
    Map<String, String> prefs = Maps.newHashMap();
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

          for (Uri uri : batch.getBatch()) {
            snippets.put(uri, uri.toString());
          }
          uriBuilder.addQueryParameter("SPLIT", "1");
        }
        results.add(new ConcatData(uriBuilder.toUri(), snippets));
      }
      return results;
    }

    public ConcatUri process(Uri uri) {
View Full Code Here

    uri.addQueryParameter(Param.URL.getKey(), SPEC_URI.toString());
    uri.addQueryParameter(Param.CONTAINER.getKey(), CONTAINER);
    if (version != null) {
      uri.addQueryParameter(Param.VERSION.getKey(), version);
    }
    return uri.toUri();
  }
   
  private TestDefaultIframeUriManager makeManager(boolean alwaysToken, boolean ldRequired) {
    ContainerConfig config = createMock(ContainerConfig.class);
    String altContainer = CONTAINER + "-alt";
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

    }
    if (ctx.getExtensionParams() != null) {
      uri.addQueryParameters(ctx.getExtensionParams());
    }

    return uri.toUri();
  }

  /**
   * Essentially pulls apart a Uri created by makeExternJsUri, validating its
   * contents, especially the version key.
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

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.