gpt4 book ai didi

com.openhtmltopdf.util.XRLog.load()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 04:13:05 31 4
gpt4 key购买 nike

本文整理了Java中com.openhtmltopdf.util.XRLog.load()方法的一些代码示例,展示了XRLog.load()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XRLog.load()方法的具体详情如下:
包路径:com.openhtmltopdf.util.XRLog
类名称:XRLog
方法名:load

XRLog.load介绍

暂无

代码示例

代码示例来源:origin: danfickle/openhtmltopdf

public static void load(String msg) {
  load(Level.INFO, msg);
}

代码示例来源:origin: danfickle/openhtmltopdf

@Override
public void put(String key, FSCacheValue value) {
  XRLog.load(Level.INFO, "Putting key(" + key + ") in cache.");
  _store.put(key, value);
}

代码示例来源:origin: danfickle/openhtmltopdf

@Override
  public FSCacheValue get(String key) {
    FSCacheValue value = _store.get(key);
    XRLog.load(Level.INFO, (value == null ? "Missed" : "Hit") + " key(" + key + ") from cache.");
    return value;
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

public void error(SAXParseException ex) {
  XRLog.load(ex.getMessage());
}

代码示例来源:origin: danfickle/openhtmltopdf

public void warning(SAXParseException ex) {
    XRLog.load(ex.getMessage());
  }
});

代码示例来源:origin: danfickle/openhtmltopdf

public void fatalError(SAXParseException ex) {
  XRLog.load(ex.getMessage());
}

代码示例来源:origin: danfickle/openhtmltopdf

private void setTranformerFactorySecurityFeatures(TransformerFactory xformFactory) {
  try {
   xformFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
   xformFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
  } catch (IllegalArgumentException e) {
   XRLog.load(Level.SEVERE, "Unable to disable XML External Entities, which might put you at risk to XXE attacks", e);
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

private TransformerFactory loadPreferredTransformerFactory(String preferredImpl) {
  try {
    return TransformerFactory.newInstance(preferredImpl, null);
  } catch (TransformerFactoryConfigurationError e) {
    XRLog.load(Level.SEVERE, "Could not load preferred XML transformer, using default which may not be secure.");
    return TransformerFactory.newInstance();
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

private DocumentBuilderFactory loadPreferredDocumentBuilderFactory(String preferredImpl) {
  try {
    return preferredImpl == null ? DocumentBuilderFactory.newInstance() : DocumentBuilderFactory.newInstance(preferredImpl, null);
  } catch (FactoryConfigurationError e) {
    XRLog.load(Level.SEVERE, "Could not load preferred XML document builder, using default which may not be secure.");
    return DocumentBuilderFactory.newInstance();
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

private void setXmlReaderSecurityFeatures(XMLReader xmlReader) {
  try {
    // VERY IMPORTANT: Without these lines, users can pull in arbitary files from the system using XXE.
    // DO NOT REMOVE!
    xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
    xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false);
    xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
    xmlReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", true);
    xmlReader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
  } catch (SAXNotSupportedException e) {
    XRLog.load(Level.SEVERE, "Unable to disable XML External Entities, which might put you at risk to XXE attacks", e);
  } catch (SAXNotRecognizedException e) {
    XRLog.load(Level.SEVERE, "Unable to disable XML External Entities, which might put you at risk to XXE attacks", e);
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

private void setDocumentBuilderSecurityFeatures(DocumentBuilderFactory dbf) {
  try {
     // VERY IMPORTANT: Without these lines, users can pull in arbitary files from the system using XXE.
     // DO NOT REMOVE!
   dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
   dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
   dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
   dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
   dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
  } catch (ParserConfigurationException e) {
   XRLog.load(Level.SEVERE, "Unable to disable XML External Entities, which might put you at risk to XXE attacks", e);
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

/**
 * Attempts to set requested feature on the parser; logs exception if not supported
 * or not recognized.
 */
private void setFeature(XMLReader xmlReader, String featureUri, String configName) {
  try {
    xmlReader.setFeature(featureUri, Configuration.isTrue(configName, false));
    XRLog.load(Level.FINE, "SAX Parser feature: " +
        featureUri.substring(featureUri.lastIndexOf("/")) +
        " set to " +
        xmlReader.getFeature(featureUri));
  } catch (SAXNotSupportedException ex) {
    XRLog.load(Level.WARNING, "SAX feature not supported on this XMLReader: " + featureUri);
  } catch (SAXNotRecognizedException ex) {
    XRLog.load(Level.WARNING, "SAX feature not recognized on this XMLReader: " + featureUri +
        ". Feature may be properly named, but not recognized by this parser.");
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

/**
 * Get the binary content of an embedded base 64 image.
 *
 * @param imageDataUri URI of the embedded image
 * @return The binary content
 */
public static byte[] getEmbeddedBase64Image(String imageDataUri) {
  int b64Index = imageDataUri.indexOf("base64,");
  if (b64Index != -1) {
    String b64encoded = imageDataUri.substring(b64Index + "base64,".length());
    return Base64.getMimeDecoder().decode(b64encoded);
  } else {
    XRLog.load(Level.SEVERE, "Embedded data uris must be encoded in base 64.");
  }
  return null;
}

代码示例来源:origin: danfickle/openhtmltopdf

@Override
public FSCacheValue get(String key, Callable<? extends FSCacheValue> loader) {
  if (_store.containsKey(key)) {
    return this.get(key);
  }

  FSCacheValue value;
  try {
    value = loader.call();
    if (value != null) {
      _store.put(key, value);
    }
  } catch (Exception e) {
    XRLog.exception("Could not load cache value for key(" + key + ")", e);
    value = null;
  }
  
  XRLog.load(Level.INFO, (value == null ? "Missed" : "Hit") + " key(" + key + ") from cache.");
  return value;
}

代码示例来源:origin: danfickle/openhtmltopdf

public void stopLoading() {
  if (_loadQueue != null) {
    XRLog.load("By request, clearing pending items from load queue: " + _loadQueue.size());
    _loadQueue.reset();
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

/**
 * Sets all standard features for SAX parser, using values from Configuration.
 */
private void setParserFeatures(XMLReader xmlReader) {
  try {        // perf: validation off
    xmlReader.setFeature("http://xml.org/sax/features/validation", false);
    // perf: namespaces
    xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
  } catch (SAXException s) {
    // nothing to do--some parsers will not allow setting features
    XRLog.load(Level.WARNING, "Could not set validation/namespace features for XML parser," +
        "exception thrown.", s);
  }
  if (Configuration.isFalse("xr.load.configure-features", false)) {
    XRLog.load(Level.FINE, "SAX Parser: by request, not changing any parser features.");
    return;
  }
  
  // perf: validation off
  setFeature(xmlReader, "http://xml.org/sax/features/validation", "xr.load.validation");
  
  // mem: intern strings
  setFeature(xmlReader, "http://xml.org/sax/features/string-interning", "xr.load.string-interning");
  
  // perf: namespaces
  setFeature(xmlReader, "http://xml.org/sax/features/namespaces", "xr.load.namespaces");
  setFeature(xmlReader, "http://xml.org/sax/features/namespace-prefixes", "xr.load.namespace-prefixes");
}

代码示例来源:origin: danfickle/openhtmltopdf

private List<Stylesheet> readAndParseAll(List<StylesheetInfo> infos, String medium) {
  List<Stylesheet> result = new ArrayList<Stylesheet>(infos.size() + 15);
  
  for (StylesheetInfo info : infos) {
    if (info.appliesToMedia(medium)) {
      Stylesheet sheet = info.getStylesheet();
      
      if (sheet == null) {
        sheet = _stylesheetFactory.getStylesheet(info);
      }
      
      if (sheet != null) {
        if (sheet.getImportRules().size() > 0) {
          result.addAll(readAndParseAll(sheet.getImportRules(), medium));
        }
        
        result.add(sheet);
      } else {
        XRLog.load(Level.WARNING, "Unable to load CSS from "+info.getUri());
      }
    }
  }
  
  return result;
}

代码示例来源:origin: danfickle/openhtmltopdf

/**
 * Retrieves the CSS located at the given URI.  It's assumed the URI does point to a CSS file--the URI will
 * be resolved, accessed (using the set FSStreamFactory or URL::openStream), opened, read and then passed into the CSS parser.
 * The result is packed up into an CSSResource for later consumption.
 *
 * @param uri Location of the CSS source.
 * @return A CSSResource containing the CSS reader or null if not available.
 */
@Override
public CSSResource getCSSResource(String uri) {
  String resolved = _resolver.resolveURI(this._baseUri, uri);
  
  if (resolved == null) {
    XRLog.load(Level.INFO, "URI resolver rejected loading CSS resource at (" + uri + ")");
    return null;
  }
  
  return new CSSResource(openReader(resolved));
}

代码示例来源:origin: danfickle/openhtmltopdf

public static void main(String args[]) {
  try {
    XRLog.cascade("Cascade msg");
    XRLog.cascade(Level.WARNING, "Cascade msg");
    XRLog.exception("Exception msg");
    XRLog.exception("Exception msg", new Exception());
    XRLog.general("General msg");
    XRLog.general(Level.WARNING, "General msg");
    XRLog.init("Init msg");
    XRLog.init(Level.WARNING, "Init msg");
    XRLog.load("Load msg");
    XRLog.load(Level.WARNING, "Load msg");
    XRLog.match("Match msg");
    XRLog.match(Level.WARNING, "Match msg");
    XRLog.layout("Layout msg");
    XRLog.layout(Level.WARNING, "Layout msg");
    XRLog.render("Render msg");
    XRLog.render(Level.WARNING, "Render msg");
  } catch (Exception ex) {
    ex.printStackTrace();
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

/**
 * Returns a cached sheet by its key; loads and caches it if not in cache;
 * null if not able to load
 *
 * @param info The StylesheetInfo for this sheet
 * @return The stylesheet
 */
//TODO: this looks a bit odd
public Stylesheet getStylesheet(StylesheetInfo info) {
  XRLog.load("Requesting stylesheet: " + info.getUri());
  Stylesheet s = getCachedStylesheet(info.getUri());
  if (s == null && !containsStylesheet(info.getUri())) {
    s = parse(info);
    putStylesheet(info.getUri(), s);
  }
  return s;
}

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com