Package com.google.caja.lexer

Examples of com.google.caja.lexer.InputSource


    boolean passed = false;

    MessageQueue mq = new SimpleMessageQueue();
    MessageContext mc = new MessageContext();
    Uri contextUri = req.getUri();
    InputSource is = new InputSource(contextUri.toJavaUri());

    PluginMeta pluginMeta = new PluginMeta(
            proxyFetcher(req, contextUri), proxyUriPolicy(req));
    PluginCompiler compiler = new PluginCompiler(BuildInfo.getInstance(),
            pluginMeta, mq);
View Full Code Here


        try {
          HttpResponse response = requestPipeline.execute(request);
          byte[] responseBytes = IOUtils.toByteArray(response.getResponse());
          return FetchedData.fromBytes(responseBytes, mimeType, response.getEncoding(),
              new InputSource(ref.getUri()));
        } catch (GadgetException e) {
          if (LOG.isLoggable(Level.INFO)) {
            LOG.logp(Level.INFO, classname, "proxyFetcher", MessageKeys.FAILED_TO_RETRIEVE, new Object[] {ref.toString()});
          }
          return null;
View Full Code Here

  }

  public CajoledResult rewrite(Uri uri, String container, String mime,
      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));
View Full Code Here

    if (debug) {
      gadget.addFeature("caja-debug");
    }

    InputSource is = new InputSource(gadgetContext.getUrl().toJavaUri());
    CajoledResult result =
      rewrite(gadgetContext.getUrl(), gadgetContext.getContainer(),
          new Dom(root), true, debug);

    if (result.hasErrors) {
View Full Code Here

            new HttpRequest(resourceUri).setContainer(container).setGadget(gadgetUri);
        try {
          HttpResponse response = requestPipeline.execute(request);
          byte[] responseBytes = IOUtils.toByteArray(response.getResponse());
          return FetchedData.fromBytes(responseBytes, mimeType, response.getEncoding(),
              new InputSource(ref.getUri()));
        } catch (GadgetException e) {
          if (LOG.isLoggable(Level.INFO)) {
            LOG.logp(Level.INFO, CLASS_NAME, "makeFetcher", MessageKeys.FAILED_TO_RETRIEVE,
                new Object[] {ref.toString()});
          }
View Full Code Here

      MessageQueue mq = new SimpleMessageQueue();
      BuildInfo bi = BuildInfo.getInstance();
      DefaultGadgetRewriter rw = new DefaultGadgetRewriter(bi, mq);
      rw.setValijaMode(true);
      InputSource is = new InputSource(retrievedUri);
      String origContent = content.getContent();
      CharProducer input = CharProducer.Factory.create(
          new StringReader(origContent),
          FilePosition.instance(is, 5, 5, 5));
      StringBuilder output = new StringBuilder();
View Full Code Here

    }
    return parsedCss;
  }

  private CssTree.StyleSheet parseImpl(String css) throws ParseException {
    InputSource inputSource = new InputSource(FAKE_SOURCE);
    CharProducer producer = CharProducer.Factory.create(new StringReader(css),
        inputSource);
    TokenStream<CssTokenType> lexer = new CssLexer(producer);
    TokenQueue<CssTokenType> queue = new TokenQueue<CssTokenType>(lexer, inputSource,
        new Criterion<Token<CssTokenType>>() {
View Full Code Here

  }

  List<Object> parseImpl(String content) throws GadgetException {
    List<Object> parsedCss = Lists.newArrayList();
    CharProducer producer = CharProducer.Factory.create(new StringReader(content),
        new InputSource(DUMMY_SOURCE));
    CssLexer lexer = new CssLexer(producer);
    try {
      StringBuilder builder = new StringBuilder();
      boolean inImport = false;
      while (lexer.hasNext()) {
View Full Code Here

        }
      }
      MessageQueue mq = new SimpleMessageQueue();
      BuildInfo bi = BuildInfo.getInstance();
      DefaultGadgetRewriter rw = new DefaultGadgetRewriter(bi, mq);
      InputSource is = new InputSource(retrievedUri);
      boolean safe = false;
     
      try {
        Pair<Node, Element> htmlAndJs = rw.rewriteContent(retrievedUri, root, cb);
        Node html = htmlAndJs.a;
View Full Code Here

  protected boolean needsDebugData() {
    return false;
  }
 
  private DomParser getDomParser(String source, final MessageQueue mq) throws ParseException {
    InputSource is = getInputSource();
    HtmlLexer lexer = new HtmlLexer(CharProducer.Factory.fromString(source, is));
    final Namespaces ns = Namespaces.HTML_DEFAULT;  // Includes OpenSocial
    final boolean needsDebugData = needsDebugData();
    DomParser parser = new DomParser(lexer, is, ns, mq);
    parser.setDomImpl(documentFactory);
View Full Code Here

TOP

Related Classes of com.google.caja.lexer.InputSource

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.