Examples of Gadget


Examples of org.apache.shindig.gadgets.Gadget

  }

  @Test
  public void honorSchemeOverride() throws Exception {
    String scheme = "file";
    Gadget gadget = mockGadget();
    TestDefaultIframeUriManager manager = makeManager(false, false);
    manager.setScheme(scheme);
    Uri result = manager.makeRenderingUri(gadget);
    assertNotNull(result);
    UriBuilder uri = new UriBuilder(result);
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

    assertEquals(UriStatus.VALID_UNVERSIONED, manager.validateRenderingUri(testUri));
  }

  @Test
  public void schemeLessUnlockedDomain() throws Exception {
    Gadget gadget = mockGadget();
    ContainerConfig config = new BasicContainerConfig();
    config
        .newTransaction()
        .addContainer(ImmutableMap.<String, Object>builder()
            .put(ContainerConfig.CONTAINER_KEY, ContainerConfig.DEFAULT_CONTAINER)
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

    }
  }

  private UriPolicy proxyUriPolicy(HttpRequest request) {
    final Uri contextUri = request.getUri();
    final Gadget stubGadget = DomWalker.makeGadget(request);

    return new UriPolicy() {
      public String rewriteUri(ExternalReference ref, UriEffect effect,
          LoaderType loader, Map<String, ?> hints) {
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

        }
      };
      // TODO: os:HttpRequest and Preload do not use the content rewriter.
      // Should we really do so here?
      try {
        Gadget gadget = processor.process(context);
        results = contentRewriterRegistry.rewriteHttpResponse(req, results, gadget);
      } catch (ProcessingException e) {
        //If there is an error creating the gadget object just rewrite the content without
        //the gadget object.  This will result in any content rewrite params not being
        //honored, but its better than the request failing all together.
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

    if (gadgetUri == null) {
      throw new GadgetException(GadgetException.Code.MISSING_PARAMETER,
              "Unable to find gadget in request", HttpResponse.SC_FORBIDDEN);
    }

    Gadget gadget;
    GadgetContext context = new HttpGadgetContext(request) {
      @Override
      public Uri getUrl() {
        return gadgetUri;
      }
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

        templates.add(element);
      }
    }

    if (!templates.isEmpty()) {
      Gadget gadget = templateContext.getGadget();

      MessageBundle bundle = messageBundleFactory.getBundle(gadget.getSpec(),
          gadget.getContext().getLocale(), gadget.getContext().getIgnoreCache(),
          gadget.getContext().getContainer(), gadget.getContext().getView());
      MessageELResolver messageELResolver = new MessageELResolver(expressions, bundle);

      int autoUpdateID = 0;
      for (Element template : templates) {
        DocumentFragment result = processor.get().processTemplate(
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

      this.context = context;
    }

    public JSONObject call() throws RpcException {
      try {
        Gadget gadget = processor.process(context);
        GadgetSpec spec = gadget.getSpec();

        JSONObject gadgetJson = new JSONObject();

        ModulePrefs prefs = spec.getModulePrefs();
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

    try {
      GadgetSpec spec = gadgetSpecFactory.getGadgetSpec(context);
      spec = substituter.substitute(context, spec);

      return new Gadget()
          .setContext(context)
          .setGadgetFeatureRegistry(gadgetFeatureRegistry)
          .setSpec(spec)
          .setCurrentView(getView(context, spec));
    } catch (GadgetException e) {
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

    if (!validateParent(context)) {
      return RenderingResults.error("Unsupported parent parameter. Check your container code.");
    }

    try {
      Gadget gadget = processor.process(context);

      if (gadget.getCurrentView() == null) {
        return RenderingResults.error("Unable to locate an appropriate view in this gadget. " +
            "Requested: '" + gadget.getContext().getView() +
            "' Available: " + gadget.getSpec().getViews().keySet());
      }

      if (gadget.getCurrentView().getType() == View.ContentType.URL) {
        return RenderingResults.mustRedirect(gadget.getCurrentView().getHref());
      }

      if (!lockedDomainService.gadgetCanRender(context.getHost(), gadget, context.getContainer())) {
        return RenderingResults.error("Invalid domain");
      }
View Full Code Here

Examples of org.apache.shindig.gadgets.Gadget

        templates.add(element);
      }
    }
   
    if (!templates.isEmpty()) {
      Gadget gadget = templateContext.getGadget();
     
      MessageBundle bundle = messageBundleFactory.getBundle(gadget.getSpec(),
          gadget.getContext().getLocale(), gadget.getContext().getIgnoreCache());
      MessageELResolver messageELResolver = new MessageELResolver(expressions, bundle);
 
      int autoUpdateID = 0;
      for (Element template : templates) {
        DocumentFragment result = processor.get().processTemplate(
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.