本文整理了Java中org.mule.util.xmlsecurity.XMLSecureFactories
类的一些代码示例,展示了XMLSecureFactories
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLSecureFactories
类的具体详情如下:
包路径:org.mule.util.xmlsecurity.XMLSecureFactories
类名称:XMLSecureFactories
[英]Provide XML parser factories configured to avoid XXE and BL attacks according to global configuration (safe by default)
[中]根据全局配置提供配置为避免XXE和BL攻击的XML解析器工厂(默认安全)
代码示例来源:origin: org.mule.modules/mule-module-xml
private static org.w3c.dom.Document parseXML(InputSource source) throws Exception
{
DocumentBuilderFactory factory = XMLSecureFactories.createDefault().getDocumentBuilderFactory();
return factory.newDocumentBuilder().parse(source);
}
代码示例来源:origin: org.mule.modules/mule-module-spring-config
protected XMLReader createSaxAnnotator(Document doc) throws ParserConfigurationException, SAXException
{
SAXParserFactory saxParserFactory = XMLSecureFactories.createDefault().getSAXParserFactory();
SAXParser saxParser = saxParserFactory.newSAXParser();
XMLReader documentReader = saxParser.getXMLReader();
documentReader.setContentHandler(new XmlMetadataAnnotator(doc, metadataFactory));
return documentReader;
}
代码示例来源:origin: org.mule.modules/mule-module-json
@Override
public TransformerFactory getTransformerFactory()
{
return XMLSecureFactories.createDefault().getTransformerFactory();
}
}
代码示例来源:origin: org.mule.modules/mule-module-xml
public static TransformerFactory createSaxonTransformerFactory() {
TransformerFactory factory = (TransformerFactory) createInstance(SAXON_TRANSFORMER_FACTORY);
XMLSecureFactories.createDefault().configureTransformerFactory(factory);
return factory;
}
代码示例来源:origin: org.mule.modules/mule-module-jersey
@Override
@PerThread
public XMLInputFactory provide() {
XMLInputFactory factory = XMLInputFactory.newInstance();
if (!isXmlSecurityDisabled()) {
factory = XMLSecureFactories.createDefault().getXMLInputFactory();
}
return factory;
}
代码示例来源:origin: org.mule.modules/mule-module-xml
public static XMLInputFactory createWstxXmlInputFactory() {
XMLInputFactory factory = (XMLInputFactory) createInstance(WSTX_INPUT_FACTORY);
XMLSecureFactories.createDefault().configureXMLInputFactory(factory);
return factory;
}
代码示例来源:origin: org.mule.modules/mule-module-xml
/**
* Create a validator.
*
* @return The validator.
*/
public Validator createValidator() throws SAXException
{
Validator validator = getSchemaObject().newValidator();
XMLSecureFactories.createDefault().configureValidator(validator);
if (this.validatorFeatures != null)
{
for (Map.Entry<String, Boolean> feature : this.validatorFeatures.entrySet())
{
validator.setFeature(feature.getKey(), feature.getValue());
}
}
if (this.validatorProperties != null)
{
for (Map.Entry<String, Object> validatorProperty : this.validatorProperties.entrySet())
{
validator.setProperty(validatorProperty.getKey(), validatorProperty.getValue());
}
}
return validator;
}
代码示例来源:origin: org.mule.modules/mule-module-xml
SchemaFactory schemaFactory = XMLSecureFactories.createDefault().getSchemaFactory(getSchemaLanguage());
代码示例来源:origin: org.mule/mule-core
public static XMLSecureFactories createWithConfig(Boolean externalEntities, Boolean expandEntities)
{
return new XMLSecureFactories(externalEntities, expandEntities);
}
代码示例来源:origin: org.mule.modules/mule-module-json
protected Object doTransform(Object src, String enc) throws TransformerException
XMLInputFactory inputFactory = XMLSecureFactories.createDefault().getXMLInputFactory();
inputFactory.setProperty(XMLInputFactory.IS_COALESCING, true);
代码示例来源:origin: org.mule/mule-core
public static XMLSecureFactories createDefault()
{
return new XMLSecureFactories();
}
代码示例来源:origin: org.mule.modules/mule-module-xml
public static Node toDOMNode(Object src, MuleEvent event) throws Exception
{
DocumentBuilderFactory builderFactory = XMLSecureFactories.createDefault().getDocumentBuilderFactory();
builderFactory.setNamespaceAware(true);
return toDOMNode(src, event, builderFactory);
}
代码示例来源:origin: org.mule.modules/mule-module-json
protected AbstractToFromXmlTransformer()
{
transformerFactory = XMLSecureFactories.createDefault().getTransformerFactory();
}
代码示例来源:origin: org.mule.modules/mule-module-jersey
@Override
@PerThread
public SAXParserFactory provide() {
SAXParserFactory factory = SAXParserFactory.newInstance();
if (!isXmlSecurityDisabled()) {
factory = XMLSecureFactories.createDefault().getSAXParserFactory();
}
factory.setNamespaceAware(true);
return factory;
}
代码示例来源:origin: org.mule.modules/mule-module-xml
public XPathNodeExpressionEvaluator()
{
try
{
builder = XMLSecureFactories.createDefault().getDocumentBuilderFactory().newDocumentBuilder();
}
catch (ParserConfigurationException e)
{
throw new ExpressionRuntimeException(XmlMessages.failedToCreateDocumentBuilder(), e);
}
}
代码示例来源:origin: org.mule.modules/mule-module-xml
/**
* @return a new XSLT transformer
* @throws TransformerConfigurationException if no TransformerFactory can be located in the
* runtime environment.
*/
public static Transformer getTransformer() throws TransformerConfigurationException
{
return XMLSecureFactories.createDefault().getTransformerFactory().newTransformer();
}
代码示例来源:origin: org.mule.modules/mule-module-xml
if (src instanceof String)
SAXParserFactory spf = XMLSecureFactories.createDefault().getSAXParserFactory();
spf.setNamespaceAware(true);
Source xmlSource = new SAXSource(spf.newSAXParser().getXMLReader(), new InputSource(new StringReader((String) src)));
代码示例来源:origin: org.mule.modules/mule-module-jersey
@Override
@PerThread
public DocumentBuilderFactory provide()
{
DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
if (!isXmlSecurityDisabled()) {
f = XMLSecureFactories.createDefault().getDocumentBuilderFactory();
}
f.setNamespaceAware(true);
return f;
}
代码示例来源:origin: org.mule.modules/mule-module-xml
private static String getOuterXml(XMLStreamReader xmlr) throws TransformerFactoryConfigurationError, TransformerException
{
Transformer transformer = XMLSecureFactories.createDefault().getTransformerFactory().newTransformer();
StringWriter stringWriter = new StringWriter();
transformer.transform(new StaxSource(xmlr), new StreamResult(stringWriter));
return stringWriter.toString();
}
代码示例来源:origin: org.mule.modules/mule-module-xml
public void initialise() throws InitialisationException
{
if (getDocumentBuilderFactory() == null)
{
DocumentBuilderFactory builderFactory = XMLSecureFactories.createDefault().getDocumentBuilderFactory();
builderFactory.setNamespaceAware(true);
setDocumentBuilderFactory(builderFactory);
}
}
内容来源于网络,如有侵权,请联系作者删除!