Package com.google.caja.plugin

Examples of com.google.caja.plugin.PluginMeta


      UriFetcher fetcher = makeFetcher(gadget);
      UriPolicy policy = makePolicy(gadget);
      URI javaGadgetUri = gadgetContext.getUrl().toJavaUri();
      MessageQueue mq = new SimpleMessageQueue();
      MessageContext context = new MessageContext();
      PluginMeta meta = new PluginMeta(fetcher, policy);
      PluginCompiler compiler = makePluginCompiler(meta, mq);

      compiler.setMessageContext(context);

      /**
 
View Full Code Here


    }

    private CajoledModule cajole(String text, String name) {
      MessageQueue mq = new EchoingMessageQueue(
          new PrintWriter(System.err), new MessageContext(), false);
      PluginMeta pm = new PluginMeta();
      pm.setPrecajoleMap(null);
      ModuleManager mgr = new ModuleManager(
          pm, BuildInfo.getInstance(),
          UriFetcher.NULL_NETWORK, mq);
      UncajoledModule input = uncajoled(text, name, mq);
View Full Code Here

                                   ContentTypeCheck checker,
                                   FetchedData input,
                                   OutputStream response,
                                   MessageQueue mq)
      throws UnsupportedContentTypeException {
    PluginMeta meta = new PluginMeta(uriFetcher, null);
    meta.setIdClass(CajaArguments.ID_CLASS.get(args));

    boolean htmlInline =
        CajaArguments.EMIT_HTML_IN_JS.get(args) != null
        && Boolean.valueOf(CajaArguments.EMIT_HTML_IN_JS.get(args));

    boolean pretty = CajolingService.RENDER_PRETTY.equals(
        CajaArguments.RENDERER.get(args));
    meta.setPrecajoleMinify(!pretty);

    Pair<ContentType, String> contentParams = getReturnedContentParams(args);

    try {
      OutputStreamWriter writer = new OutputStreamWriter(
View Full Code Here

  private boolean rewriteScriptEl(Node root, EmbeddedContent c) {
    Element scriptEl = (Element) c.getSource();
    Node parent = scriptEl.getParentNode();

    PluginMeta pm = jobs.getPluginMeta();
    UriFetcher fetcher = pm.getUriFetcher();

    // Try looking for the script in the precajole map
    PrecajoleMap precajoled = jobs.getPluginMeta().getPrecajoleMap();
    if (precajoled != null) {
      String sourceText = c.getContent(fetcher).toString();
      boolean minify = pm.getPrecajoleMinify();
      CajoledModule m = precajoled.lookupSource(sourceText, minify);
      if (m != null) {
        Element placeholder = placeholderFor(scriptEl, m);
        if (c.isDeferred()) {
          parent.removeChild(scriptEl);
View Full Code Here

  private PluginMeta meta;

  @Override
  public void setUp() throws Exception {
    super.setUp();
    meta = new PluginMeta(UriFetcher.NULL_NETWORK, UriPolicy.IDENTITY);
  }
View Full Code Here

        js(fromResource("template-compiler-golden1-dynamic.js")));
  }

  public final void testSafeHtmlWithNullUriPolicy() throws Exception {
    // Null URI policy also implies dynamic module ID
    meta = new PluginMeta(UriFetcher.NULL_NETWORK, null);
    assertSafeHtml(
        htmlFragment(fromResource("template-compiler-input1.html", is)),
        htmlFragment(fromResource("template-compiler-golden1-nulluripol.html")),
        js(fromResource("template-compiler-golden1-nulluripol.js")));
  }
View Full Code Here

    // Ensure that the TemplateCompiler calls its PluginEnvironment with the
    // correct information when it encounters a URI-valued HTML attribute.

    final Holder<ExternalReference> savedRef = new Holder<ExternalReference>();

    meta = new PluginMeta(
        UriFetcher.NULL_NETWORK,
        new UriPolicy() {
          public String rewriteUri(
              ExternalReference u, UriEffect effect, LoaderType loader,
              Map<String, ?> hints) {
View Full Code Here

          LoaderType loader,
          Map<String, ?> hints) {
        return "" + u.getUri() + "/URIPOLICY";
      }
    };
    meta = new PluginMeta(
        meta.getUriFetcher(),
        policy,
        meta.getPrecajoleMap(),
        meta.getPrecajoleMinify());
    assertSafeHtml(
View Full Code Here

            + "</div>")),
        new Block(), true);
  }

  public final void testStyleAttrsWithoutUriPolicy() throws Exception {
    meta = new PluginMeta(
        meta.getUriFetcher(),
        null,
        meta.getPrecajoleMap(),
        meta.getPrecajoleMinify());
    assertSafeHtml(
View Full Code Here

  protected PluginMeta meta;
  protected JobCache cache = new StubJobCache();
  private TestUriFetcher uriFetcher;

  protected PluginMeta createPluginMeta() {
    return new PluginMeta(uriFetcher, new TestUriPolicy());
  }
View Full Code Here

TOP

Related Classes of com.google.caja.plugin.PluginMeta

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.