Examples of GadgetContext


Examples of org.apache.shindig.gadgets.GadgetContext

  public String render(Gadget gadget) throws RenderingException, GadgetException {
    View view = gadget.getCurrentView();
    Uri href = view.getHref();
    Preconditions.checkArgument(href != null, "Gadget does not have href for the current view");

    GadgetContext context = gadget.getContext();
    String path = context.getParameter(PATH_PARAM);
    if (path != null) {
      try {
        Uri relative = Uri.parse(path);
        if (!relative.isAbsolute()) {
          href = href.resolve(relative);
        }
      } catch (IllegalArgumentException e) {
        // TODO: Spec does not say what to do for an invalid relative path.
        // Just ignoring for now.
      }
    }

    UriBuilder uri = new UriBuilder(href);
    uri.addQueryParameter("lang", context.getLocale().getLanguage());
    uri.addQueryParameter("country", context.getLocale().getCountry());

    OAuthArguments oauthArgs = new OAuthArguments(view);
    oauthArgs.setProxiedContentRequest(true);

    HttpRequest request = new HttpRequest(uri.toUri())
        .setIgnoreCache(context.getIgnoreCache())
        .setOAuthArguments(oauthArgs)
        .setAuthType(view.getAuthType())
        .setSecurityToken(context.getToken())
        .setContainer(context.getContainer())
        .setGadget(gadget.getSpec().getUrl());

    HttpResponse response = httpCache.getResponse(request);

    if (response == null || response.isStale()) {
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

        .append("</head><body").append(bodyAttr).append('>')
        .append(body)
        .append("</body></html>")
        .toString();

    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return "foo";
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

        .append("</head><body").append(bodyAttr).append('>')
        .append(body)
        .append("</body></html>")
        .toString();

    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return "foo";
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

      "</ModulePrefs>" +
      "<Content type='html'/>" +
      "</Module>";

    final Set<String> libs = ImmutableSortedSet.of("foo", "bar", "baz");
    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return Joiner.on(':').join(libs);
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

      "</ModulePrefs>" +
      "<Content type='html'/>" +
      "</Module>";

    final Set<String> libs = ImmutableSet.of("bar", "baz");
    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return Joiner.on(':').join(libs);
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

      "  <Require feature='bar'/>" +
      "</ModulePrefs>" +
      "<Content type='html'/>" +
      "</Module>";

    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return "baz";
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

      "</ModulePrefs>" +
      "<Content type='html'/>" +
      "</Module>";

    final Set<String> libs = ImmutableSortedSet.of("foo", "bar", "baz");
    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return Joiner.on(':').join(libs);
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

      "</ModulePrefs>" +
      "<Content type='html'/>" +
      "</Module>";

    final Set<String> libs = ImmutableSortedSet.of("core.util", "foo", "bar", "baz");
    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return Joiner.on(':').join(libs);
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

      "  <Require feature='foo'/>" +
      "</ModulePrefs>" +
      "<Content type='html'/>" +
      "</Module>";

    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return "bar";
        }
View Full Code Here

Examples of org.apache.shindig.gadgets.GadgetContext

      "<Module><ModulePrefs title=''>" +
      "</ModulePrefs>" +
      "<Content type='html'/>" +
      "</Module>";

    GadgetContext context = new GadgetContext() {
      @Override
      public String getParameter(String name) {
        if (name.equals("libs")) {
          return "bar";
        }
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.