Examples of JsResponse


Examples of org.apache.shindig.gadgets.js.JsResponse

        getContent(actual));
  }

  @Test
  public void testCompile() throws Exception {
    JsResponse actual = compiler.compile(null,
        ImmutableList.of(JsContent.fromText(COMPILE_CONTENT, "js")), null);
    assertEquals(COMPILE_CONTENT, actual.toJsString());
    assertEquals(0, actual.getErrors().size());
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    };
    return new Compiler(errorManager);
  }

  public JsResponse compile(JsUri jsUri, Iterable<JsContent> content, String externs) {
    JsResponse exportResponse = defaultCompiler.compile(jsUri, content, externs);
    content = exportResponse.getAllJsContent();

    String cacheKey = makeCacheKey(exportResponse.toJsString(), externs, jsUri);
    JsResponse cachedResult = cache.getElement(cacheKey);
    if (cachedResult != null) {
      return cachedResult;
    }

    // Only run actual compiler if necessary.
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

  }

  protected JsResponse doDebug(Iterable<JsContent> content, String cacheKey) {
    JsResponseBuilder builder = new JsResponseBuilder();
    builder.appendAllJs(content);
    JsResponse result = builder.build();
    cache.addElement(cacheKey, result);
    return result;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

      builder.appendJs(compiled, "[compiled]");
    }

    builder.clearExterns().appendRawExtern(result.externExport);

    JsResponse response = builder.build();
    cache.addElement(cacheKey, response);
    return response;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

  private JsResponse cacheAndReturnErrorResult(
      JsResponseBuilder builder, String cacheKey,
      int statusCode, List<String> messages) {
    builder.setStatusCode(statusCode);
    builder.addErrors(messages);
    JsResponse result = builder.build();
    cache.addElement(cacheKey, result);
    return result;
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    } catch (GadgetException e) {
      resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return;
    }

    JsResponse jsResponse;
    try {
      jsResponse = jsServingPipeline.execute(jsRequest);
    } catch (JsException e) {
      resp.sendError(e.getStatusCode(), e.getMessage());
      return;
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    Uri servedUri = jsUriManager.makeExternJsUri(jsUri);

    String content = null;
    Long expireMs = null;
    if (isFieldIncluded(fields, "jsContent")) {
      JsResponse response;
      try {
        response = jsPipeline.execute(jsRequestBuilder.build(jsUri, servedUri.getAuthority()));
      } catch (JsException e) {
        throw new ProcessingException(e.getMessage(), e.getStatusCode());
      }
      content = response.toJsString();
      if (response.isProxyCacheable()) {
        expireMs = getDefaultExpiration();
      }
    } else {
      expireMs = getDefaultExpiration();
    }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

   */
  protected String getFeaturesContent(JsUri jsUri) throws GadgetException {
    // Inject js content, fetched from JsPipeline
    JsRequest jsRequest = new JsRequestBuilder(jsUriManager,
        featureRegistryProvider.get(jsUri.getRepository())).build(jsUri, null);
    JsResponse jsResponse;
    try {
      jsResponse = jsServingPipeline.execute(jsRequest);
    } catch (JsException e) {
      throw new GadgetException(Code.JS_PROCESSING_ERROR, e, e.getStatusCode());
    }
    return jsResponse.toJsString();
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

    Uri servedUri = jsUriManager.makeExternJsUri(jsUri);

    String content = null;
    Long expireMs = null;
    if (isFieldIncluded(fields, "jsContent")) {
      JsResponse response;
      try {
        response = jsPipeline.execute(jsRequestBuilder.build(jsUri, servedUri.getAuthority()));
      } catch (JsException e) {
        throw new ProcessingException(e.getMessage(), e.getStatusCode());
      }
      content = response.toJsString();
      if (response.isProxyCacheable()) {
        expireMs = getDefaultExpiration();
      }
    } else {
      expireMs = getDefaultExpiration();
    }
View Full Code Here

Examples of org.apache.shindig.gadgets.js.JsResponse

   */
  protected String getFeaturesContent(JsUri jsUri) throws GadgetException {
    // Inject js content, fetched from JsPipeline
    JsRequest jsRequest = new JsRequestBuilder(jsUriManager,
        featureRegistryProvider.get(jsUri.getRepository())).build(jsUri, null);
    JsResponse jsResponse;
    try {
      jsResponse = jsServingPipeline.execute(jsRequest);
    } catch (JsException e) {
      throw new GadgetException(Code.JS_PROCESSING_ERROR, e, e.getStatusCode());
    }
    return jsResponse.toJsString();
  }
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.