Package org.apache.shindig.gadgets

Examples of org.apache.shindig.gadgets.GadgetContext


    }

    resp.setContentType("text/html");
    resp.setCharacterEncoding("UTF-8");

    GadgetContext context = new HttpGadgetContext(req);
    RenderingResults results = renderer.render(context);
    switch (results.getStatus()) {
      case OK:
        if (context.getIgnoreCache() ||
            urlstatus == UrlValidationStatus.INVALID) {
          HttpUtil.setCachingHeaders(resp, 0);
        } else if (urlstatus == UrlValidationStatus.VALID_VERSIONED) {
          // Versioned files get cached indefinitely
          HttpUtil.setCachingHeaders(resp, true);
View Full Code Here


    final ModulePrefs prefs = createMock(ModulePrefs.class);
    expect(prefs.getFeatures()).andReturn(Maps.<String, Feature>newHashMap()).anyTimes();
    replay(prefs);
    expect(spec.getModulePrefs()).andReturn(prefs).anyTimes();
    replay(spec);
    GadgetContext context = createMock(GadgetContext.class);
    expect(context.getContainer()).andReturn(CONTAINER).anyTimes();
    expect(context.getIgnoreCache()).andReturn(nocache).anyTimes();
    expect(context.getDebug()).andReturn(debug).anyTimes();
    replay(context);
    return new Gadget().setContext(context).setSpec(spec);
  }
View Full Code Here

    control = EasyMock.createStrictControl();
    preloader = control.createMock(PipelinedDataPreloader.class);
    preloaderService = new ConcurrentPreloaderService(Executors.newSingleThreadExecutor(), null);
    executor = new PipelineExecutor(preloader, preloaderService, Expressions.forTesting());
   
    context = new GadgetContext(){};
  }
View Full Code Here

  @Test
  public void executeWithTwoBatches() throws Exception {
    PipelinedData pipeline = getPipelinedData(TWO_BATCH_CONTENT);

    context = new GadgetContext() {
      @Override
      public String getParameter(String property) {
        // Provide the filename to be requested in the first batch
        if ("view-params".equals(property)) {
          return "{'file': 'test.json'}";
View Full Code Here

        .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

      "</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 Join.join(":", libs);
        }
View Full Code Here

      "</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 Join.join(":", libs);
        }
View Full Code Here

      "  <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

      "  <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

      "<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

Related Classes of org.apache.shindig.gadgets.GadgetContext

Copyright © 2018 www.massapicom. 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.