Package com.google.caja.plugin

Examples of com.google.caja.plugin.UriFetcher


      boolean es53, boolean debug) {
    URI javaUri = uri.toJavaUri();
    InputSource is = new InputSource(javaUri);
    MessageQueue mq = new SimpleMessageQueue();
    try {
      UriFetcher fetcher = makeFetcher(uri, container);
      ExternalReference extRef = new ExternalReference(javaUri,
          FilePosition.instance(is, /*lineNo*/ 1, /*charInFile*/ 1, /*charInLine*/ 1));
      // If the fetch fails, a UriFetchException is thrown and serialized as part of the
      // message queue.
      CharProducer cp = fetcher.fetch(extRef, mime).getTextualContent();
      ParseTreeNode ptn = parse(is, cp, mime, mq);
      return rewrite(uri, container, ptn, es53, debug);
    } catch (UnsupportedEncodingException e) {
      LOG.severe("Unexpected inability to recognize mime type: " + mime);
      mq.addMessage(ServiceMessageType.UNEXPECTED_INPUT_MIME_TYPE,
View Full Code Here


    return new CajoledResult(null, null, mq.getMessages(), /* hasErrors */ true);
  }

  public CajoledResult rewrite(Uri gadgetUri, String container,
      ParseTreeNode root, boolean es53, boolean debug) {
    UriFetcher fetcher = makeFetcher(gadgetUri, container);
    UriPolicy policy = makePolicy(gadgetUri);
    URI javaGadgetUri = gadgetUri.toJavaUri();
    MessageQueue mq = new SimpleMessageQueue();
    MessageContext context = new MessageContext();
    PluginMeta meta = new PluginMeta(fetcher, policy);
View Full Code Here

    mc.documentChanged();
    HtmlSerialization.attach(doc, htmlSerializer, null);
  }

  UriFetcher makeFetcher(final Uri gadgetUri, final String container) {
    return new UriFetcher() {
      public FetchedData fetch(ExternalReference ref, String mimeType)
          throws UriFetchException {
        if (LOG.isLoggable(Level.INFO)) {
          LOG.logp(Level.INFO, CLASS_NAME, "makeFetcher", MessageKeys.RETRIEVE_REFERENCE,
              new Object[] {ref.toString()});
View Full Code Here

      boolean es53, boolean debug) {
    URI javaUri = uri.toJavaUri();
    InputSource is = new InputSource(javaUri);
    MessageQueue mq = new SimpleMessageQueue();
    try {
      UriFetcher fetcher = makeFetcher(uri, container);
      ExternalReference extRef = new ExternalReference(javaUri,
          FilePosition.instance(is, /*lineNo*/ 1, /*charInFile*/ 1, /*charInLine*/ 1));
      // If the fetch fails, a UriFetchException is thrown and serialized as part of the
      // message queue.
      CharProducer cp = fetcher.fetch(extRef, mime).getTextualContent();
      ParseTreeNode ptn = parse(is, cp, mime, mq);
      return rewrite(uri, container, ptn, es53, debug);
    } catch (UnsupportedEncodingException e) {
      LOG.severe("Unexpected inability to recognize mime type: " + mime);
      mq.addMessage(ServiceMessageType.UNEXPECTED_INPUT_MIME_TYPE,
View Full Code Here

    return new CajoledResult(null, null, mq.getMessages(), /* hasErrors */ true);
  }

  public CajoledResult rewrite(Uri gadgetUri, String container,
      ParseTreeNode root, boolean es53, boolean debug) {
    UriFetcher fetcher = makeFetcher(gadgetUri, container);
    UriPolicy policy = makePolicy(gadgetUri);
    URI javaGadgetUri = gadgetUri.toJavaUri();
    MessageQueue mq = new SimpleMessageQueue();
    MessageContext context = new MessageContext();
    PluginMeta meta = new PluginMeta(fetcher, policy);
View Full Code Here

    mc.documentChanged();
    HtmlSerialization.attach(doc, htmlSerializer, null);
  }

  UriFetcher makeFetcher(final Uri gadgetUri, final String container) {
    return new UriFetcher() {
      public FetchedData fetch(ExternalReference ref, String mimeType)
          throws UriFetchException {
        if (LOG.isLoggable(Level.INFO)) {
          LOG.logp(Level.INFO, CLASS_NAME, "makeFetcher", MessageKeys.RETRIEVE_REFERENCE,
              new Object[] {ref.toString()});
View Full Code Here

      }
    };
  }

  private UriFetcher proxyFetcher(final HttpRequest req, final Uri contextUri) {
    return new UriFetcher() {
      public FetchedData fetch(ExternalReference ref, String mimeType) throws UriFetchException {
        Uri resourceUri = Uri.fromJavaUri(ref.getUri());
        if (contextUri != null) {
          resourceUri = contextUri.resolve(resourceUri);
        }
View Full Code Here

        mc.documentChanged();
      }
    }

    if (cajoledData == null) {
      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);
View Full Code Here

  private UriFetcher makeFetcher(Gadget gadget) {
    final Uri gadgetUri = gadget.getContext().getUrl();
    final String container = gadget.getContext().getContainer();
   
    return new UriFetcher() {
      public FetchedData fetch(ExternalReference ref, String mimeType)
          throws UriFetchException {
        LOG.info("Retrieving " + ref.toString());
        Uri resourceUri = gadgetUri.resolve(Uri.fromJavaUri(ref.getUri()));
        HttpRequest request =
View Full Code Here

      }
    };
  }

  private UriFetcher proxyFetcher(final HttpRequest req, final Uri contextUri) {
    return new UriFetcher() {
      public FetchedData fetch(ExternalReference ref, String mimeType) throws UriFetchException {
        Uri resourceUri = Uri.fromJavaUri(ref.getUri());
        if (contextUri != null) {
          resourceUri = contextUri.resolve(resourceUri);
        }
View Full Code Here

TOP

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

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.