gpt4 book ai didi

com.sun.xml.ws.util.xml.XmlUtil.xmlSecurityDisabled()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 19:35:05 27 4
gpt4 key购买 nike

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

XmlUtil.xmlSecurityDisabled介绍

暂无

代码示例

代码示例来源:origin: javaee/metro-jax-ws

public static XMLInputFactory newXMLInputFactory(boolean disableSecurity)  {
  XMLInputFactory factory = XMLInputFactory.newInstance();
  if (xmlSecurityDisabled(disableSecurity)) {
    // TODO-Miran: are those apppropriate defaults?
    factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
    factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

public static XMLInputFactory newXMLInputFactory(boolean disableSecurity)  {
  XMLInputFactory factory = XMLInputFactory.newInstance();
  if (xmlSecurityDisabled(disableSecurity)) {
    // TODO-Miran: are those apppropriate defaults?
    factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
    factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/rt

public static XMLInputFactory newXMLInputFactory(boolean disableSecurity)  {
  XMLInputFactory factory = XMLInputFactory.newInstance();
  if (xmlSecurityDisabled(disableSecurity)) {
    // TODO-Miran: are those apppropriate defaults?
    factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
    factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/rt

public static XPathFactory newXPathFactory(boolean disableSecurity) {
  XPathFactory factory = XPathFactory.newInstance();
  try {
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
  } catch (XPathFactoryConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

public static XPathFactory newXPathFactory(boolean disableSecurity) {
  XPathFactory factory = XPathFactory.newInstance();
  try {
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
  } catch (XPathFactoryConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

public static TransformerFactory newTransformerFactory(boolean disableSecurity) {
  TransformerFactory factory = TransformerFactory.newInstance();
  try {
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
  } catch (TransformerConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
  }
  return factory;
}

代码示例来源:origin: javaee/metro-jax-ws

public static XPathFactory newXPathFactory(boolean disableSecurity) {
  XPathFactory factory = XPathFactory.newInstance();
  try {
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
  } catch (XPathFactoryConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/rt

public static TransformerFactory newTransformerFactory(boolean disableSecurity) {
  TransformerFactory factory = TransformerFactory.newInstance();
  try {
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
  } catch (TransformerConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
  }
  return factory;
}

代码示例来源:origin: javaee/metro-jax-ws

public static TransformerFactory newTransformerFactory(boolean disableSecurity) {
  TransformerFactory factory = TransformerFactory.newInstance();
  try {
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
  } catch (TransformerConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

public static SAXParserFactory newSAXParserFactory(boolean disableSecurity) {
  SAXParserFactory factory = SAXParserFactory.newInstance();
  String featureToSet = XMLConstants.FEATURE_SECURE_PROCESSING;
  try {
    boolean securityOn = !xmlSecurityDisabled(disableSecurity);
    factory.setFeature(featureToSet, securityOn);
    factory.setNamespaceAware(true);
    if (securityOn) {
      featureToSet = DISALLOW_DOCTYPE_DECL;
      factory.setFeature(featureToSet, true);
      featureToSet = EXTERNAL_GE;
      factory.setFeature(featureToSet, false);
      featureToSet = EXTERNAL_PE;
      factory.setFeature(featureToSet, false);
      featureToSet = LOAD_EXTERNAL_DTD;
      factory.setFeature(featureToSet, false);
    }
  } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support "+featureToSet+" feature!", new Object[]{factory.getClass().getName()});
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

public static DocumentBuilderFactory newDocumentBuilderFactory(boolean disableSecurity) {
  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  String featureToSet = XMLConstants.FEATURE_SECURE_PROCESSING;
  try {
    boolean securityOn = !xmlSecurityDisabled(disableSecurity);
    factory.setFeature(featureToSet, securityOn);
    factory.setNamespaceAware(true);
    if (securityOn) {
      factory.setExpandEntityReferences(false);
      featureToSet = DISALLOW_DOCTYPE_DECL;
      factory.setFeature(featureToSet, true);
      featureToSet = EXTERNAL_GE;
      factory.setFeature(featureToSet, false);
      featureToSet = EXTERNAL_PE;
      factory.setFeature(featureToSet, false);
      featureToSet = LOAD_EXTERNAL_DTD;
      factory.setFeature(featureToSet, false);               
    }
  } catch (ParserConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support "+featureToSet+" feature!", new Object[] {factory.getClass().getName()} );
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/rt

public static SAXParserFactory newSAXParserFactory(boolean disableSecurity) {
  SAXParserFactory factory = SAXParserFactory.newInstance();
  String featureToSet = XMLConstants.FEATURE_SECURE_PROCESSING;
  try {
    boolean securityOn = !xmlSecurityDisabled(disableSecurity);
    factory.setFeature(featureToSet, securityOn);
    factory.setNamespaceAware(true);
    if (securityOn) {
      featureToSet = DISALLOW_DOCTYPE_DECL;
      factory.setFeature(featureToSet, true);
      featureToSet = EXTERNAL_GE;
      factory.setFeature(featureToSet, false);
      featureToSet = EXTERNAL_PE;
      factory.setFeature(featureToSet, false);
      featureToSet = LOAD_EXTERNAL_DTD;
      factory.setFeature(featureToSet, false);
    }
  } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support "+featureToSet+" feature!", new Object[]{factory.getClass().getName()});
  }
  return factory;
}

代码示例来源:origin: javaee/metro-jax-ws

public static DocumentBuilderFactory newDocumentBuilderFactory(boolean disableSecurity) {
  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  String featureToSet = XMLConstants.FEATURE_SECURE_PROCESSING;
  try {
    boolean securityOn = !xmlSecurityDisabled(disableSecurity);
    factory.setFeature(featureToSet, securityOn);
    factory.setNamespaceAware(true);
    if (securityOn) {
      factory.setExpandEntityReferences(false);
      featureToSet = DISALLOW_DOCTYPE_DECL;
      factory.setFeature(featureToSet, true);
      featureToSet = EXTERNAL_GE;
      factory.setFeature(featureToSet, false);
      featureToSet = EXTERNAL_PE;
      factory.setFeature(featureToSet, false);
      featureToSet = LOAD_EXTERNAL_DTD;
      factory.setFeature(featureToSet, false);               
    }
  } catch (ParserConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support "+featureToSet+" feature!", new Object[] {factory.getClass().getName()} );
  }
  return factory;
}

代码示例来源:origin: javaee/metro-jax-ws

public static SAXParserFactory newSAXParserFactory(boolean disableSecurity) {
  SAXParserFactory factory = SAXParserFactory.newInstance();
  String featureToSet = XMLConstants.FEATURE_SECURE_PROCESSING;
  try {
    boolean securityOn = !xmlSecurityDisabled(disableSecurity);
    factory.setFeature(featureToSet, securityOn);
    factory.setNamespaceAware(true);
    if (securityOn) {
      featureToSet = DISALLOW_DOCTYPE_DECL;
      factory.setFeature(featureToSet, true);
      featureToSet = EXTERNAL_GE;
      factory.setFeature(featureToSet, false);
      featureToSet = EXTERNAL_PE;
      factory.setFeature(featureToSet, false);
      featureToSet = LOAD_EXTERNAL_DTD;
      factory.setFeature(featureToSet, false);
    }
  } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support "+featureToSet+" feature!", new Object[]{factory.getClass().getName()});
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/rt

public static DocumentBuilderFactory newDocumentBuilderFactory(boolean disableSecurity) {
  DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  String featureToSet = XMLConstants.FEATURE_SECURE_PROCESSING;
  try {
    boolean securityOn = !xmlSecurityDisabled(disableSecurity);
    factory.setFeature(featureToSet, securityOn);
    factory.setNamespaceAware(true);
    if (securityOn) {
      factory.setExpandEntityReferences(false);
      featureToSet = DISALLOW_DOCTYPE_DECL;
      factory.setFeature(featureToSet, true);
      featureToSet = EXTERNAL_GE;
      factory.setFeature(featureToSet, false);
      featureToSet = EXTERNAL_PE;
      factory.setFeature(featureToSet, false);
      featureToSet = LOAD_EXTERNAL_DTD;
      factory.setFeature(featureToSet, false);               
    }
  } catch (ParserConfigurationException e) {
    LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support "+featureToSet+" feature!", new Object[] {factory.getClass().getName()} );
  }
  return factory;
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecurity) {
  // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
  if (xmlSecurityDisabled(disableSecurity)) {
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary.");
    }
    return sf;
  }
  if (System.getProperty("javax.xml.accessExternalSchema") != null) {
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary.");
    }
    return sf;
  }
  try {
    sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value);
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
    }
  } catch (SAXException ignored) {
    // nothing to do; support depends on version JDK or SAX implementation
    if (LOGGER.isLoggable(Level.CONFIG)) {
      LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
    }
  }
  return sf;
}

代码示例来源:origin: com.sun.xml.ws/rt

public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecurity) {
  // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
  if (xmlSecurityDisabled(disableSecurity)) {
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary.");
    }
    return sf;
  }
  if (System.getProperty("javax.xml.accessExternalSchema") != null) {
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary.");
    }
    return sf;
  }
  try {
    sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value);
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
    }
  } catch (SAXException ignored) {
    // nothing to do; support depends on version JDK or SAX implementation
    if (LOGGER.isLoggable(Level.CONFIG)) {
      LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
    }
  }
  return sf;
}

代码示例来源:origin: javaee/metro-jax-ws

public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecurity) {
  // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
  if (xmlSecurityDisabled(disableSecurity)) {
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary.");
    }
    return sf;
  }
  if (System.getProperty("javax.xml.accessExternalSchema") != null) {
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary.");
    }
    return sf;
  }
  try {
    sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value);
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
    }
  } catch (SAXException ignored) {
    // nothing to do; support depends on version JDK or SAX implementation
    if (LOGGER.isLoggable(Level.CONFIG)) {
      LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
    }
  }
  return sf;
}

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