Package com.google.caja.plugin

Examples of com.google.caja.plugin.JobEnvelope


  // the extract scripts with the scripts that generate markup.
  private Element placeholderFor(Node n, Block parsedScriptBody) {
    String id = "$" + jobs.getPluginMeta().generateGuid();
    Element placeholder = Placeholder.make(n, id);
    URI baseUri = htmlEnv.job.getBaseUri();
    jobs.getJobs().add(new JobEnvelope(
        id, jobCache.forJob(ContentType.JS, parsedScriptBody).asSingleton(),
        ContentType.JS, false,
        Job.jsJob(parsedScriptBody, baseUri)));
    return placeholder;
  }
View Full Code Here


  }

  private Element placeholderFor(Node n, CajoledModule m) {
    String id = "$" + jobs.getPluginMeta().generateGuid();
    Element placeholder = Placeholder.make(n, id);
    jobs.getJobs().add(new JobEnvelope(id, JobCache.none(),
        ContentType.JS, true, Job.cajoledJob(m)));
    return placeholder;
  }
View Full Code Here

    jobs.getJobs().add(
        // Insert CSS stylesheets before the HTML job so that stylesheets always
        // are loaded before the HTML job even if they have different cache
        // keys.
        jobs.getJobs().indexOf(htmlEnv),
        new JobEnvelope(
            null,
            // jobCache.forJob(ContentType.CSS, stylesheet).asSingleton(),
            JobCache.none(),
            ContentType.CSS, false,
            Job.cssJob(stylesheet, baseUri)));
View Full Code Here

    List<ValidatedStylesheet> css = Lists.newArrayList();
    List<ScriptPlaceholder> js = Lists.newArrayList();
    URI baseUriForJsModules = null;

    for (Iterator<JobEnvelope> it = jobs.getJobs().iterator(); it.hasNext();) {
      JobEnvelope env = it.next();
      Job job = env.job;
      switch (env.sourceType) {
        case CSS:
          if (!env.fromCache) {
            css.add(new ValidatedStylesheet(
View Full Code Here

  // the extract scripts with the scripts that generate markup.
  private Element placeholderFor(Node n, Block parsedScriptBody) {
    String id = "$" + jobs.getPluginMeta().generateGuid();
    Element placeholder = Placeholder.make(n, id);
    URI baseUri = htmlEnv.job.getBaseUri();
    jobs.getJobs().add(new JobEnvelope(
        id, jobCache.forJob(ContentType.JS, parsedScriptBody).asSingleton(),
        ContentType.JS, false,
        Job.jsJob(parsedScriptBody, baseUri)));
    return placeholder;
  }
View Full Code Here

  }

  private Element placeholderFor(Node n, CajoledModule m) {
    String id = "$" + jobs.getPluginMeta().generateGuid();
    Element placeholder = Placeholder.make(n, id);
    jobs.getJobs().add(new JobEnvelope(id, JobCache.none(),
        ContentType.JS, true, Job.cajoledJob(m)));
    return placeholder;
  }
View Full Code Here

    jobs.getJobs().add(
        // Insert CSS stylesheets before the HTML job so that stylesheets always
        // are loaded before the HTML job even if they have different cache
        // keys.
        jobs.getJobs().indexOf(htmlEnv),
        new JobEnvelope(
            null,
            // jobCache.forJob(ContentType.CSS, stylesheet).asSingleton(),
            JobCache.none(),
            ContentType.CSS, false,
            Job.cssJob(stylesheet, baseUri)));
View Full Code Here

                         ""
                        + "IMPORTS___.htmlEmitter___"
                        + "    ./*@synthetic*/addBodyClasses(@idents);",
                        "idents", e));
                Block b = new Block(FilePosition.UNKNOWN, Collections.singletonList(s));
                jobs.getJobs().add(new JobEnvelope(
                    null, htmlEnv.cacheKeys, ContentType.JS, false,
                    Job.jsJob(b, htmlEnv.job.getBaseUri())));
              }
            }
          }
View Full Code Here

  List<SafeStylesheet> make() {
    if (validatedStylesheets.isEmpty()) { return Collections.emptyList(); }

    List<SafeStylesheet> out = Lists.newArrayList();

    JobEnvelope currentSource = validatedStylesheets.get(0).source;
    URI currentUri = validatedStylesheets.get(0).baseUri;
    int pos = 0;
    int n = validatedStylesheets.size();
    for (int i = 0; i < n; ++i) {
      ValidatedStylesheet vss = validatedStylesheets.get(i);
View Full Code Here

  public boolean apply(Jobs jobs) {
    MessageQueue mq = jobs.getMessageQueue();
    for (ListIterator<JobEnvelope> it = jobs.getJobs().listIterator();
         it.hasNext();) {
      JobEnvelope env = it.next();
      if (env.fromCache) { continue; }
      Job job = env.job;
      if (job.getType() != ContentType.HTML) { continue; }
      Dom dom = (Dom) job.getRoot();
      Node node = dom.getValue();
      URI baseUri = baseUri(node, job.getBaseUri(), dom.getFilePosition());
      if (baseUri != null) {
        try {
          baseUri = URI.create(UriUtil.normalizeUri(baseUri.toString()));
        } catch (URISyntaxException ex) {
          mq.addMessage(
              PluginMessageType.MALFORMED_URL, dom.getFilePosition(),
              MessagePart.Factory.valueOf(baseUri.toString()));
          baseUri = null;
        }
      }
      if (baseUri != null) {
        resolveRelativeUrls(node, baseUri, mq);
        it.set(env.withJob(Job.domJob(dom, baseUri)));
      }
    }
    return true;
  }
View Full Code Here

TOP

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

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.