gpt4 book ai didi

org.n52.security.common.xml.XMLPathCtx.createNew()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 05:09:05 25 4
gpt4 key购买 nike

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

XMLPathCtx.createNew介绍

[英]Method creates a new XMLPathCtx instance. The instance uses the internaly xpath instance pool.
[中]方法创建一个新的XMLPathCtx实例。该实例使用internaly xpath实例池。

代码示例

代码示例来源:origin: org.n52.metadata/smarteditor-api

public TemplateFactory(Map<String, String> namespaces) {
  context = XMLPathCtx.createNew();
  context.addNamespaces(namespaces);
}

代码示例来源:origin: org.n52.metadata/smarteditor-api

public XPathContextFactory(Map<String, String> namespaces) {
  xmlPathCtx = XMLPathCtx.createNew();
  xmlPathCtx.addNamespaces(namespaces);
}

代码示例来源:origin: org.n52.security/52n-security-decision-xacml

public void debugPDPRequest(final Element request) {
  StringBuilder text = new StringBuilder();
  NodeList requestChildNodes = XMLPathCtx.createNew().findIn(request).all("/*[local-name() = 'Request']/*").get();
  for (int i = 0; i < requestChildNodes.getLength(); i++) {
    Element requestChild = (Element) requestChildNodes.item(i);
    text.append(requestChild.getLocalName()).append("\n");
    appendAttributes(text, XMLPathCtx.createNew().findIn(requestChild).all(".//*[local-name()='AttributeValue']").get());
  }
  LOG.debug("PDP request\n" + text);
}

代码示例来源:origin: org.n52.security/52n-security-decision-xacml

XACML2ResponseChunkHandler(List<ResponseDocument> responseSet) {
  m_responseSet = responseSet;
  xmlPathCtx = XMLPathCtx.createNew();
  xmlPathCtx.addNamespace("c", "urn:oasis:names:tc:xacml:2.0:context:schema:os").addNamespace("p",
      "urn:oasis:names:tc:xacml:2.0:policy:schema:os");
}

代码示例来源:origin: org.n52.security/52n-security-decision-xacml

private void debugPDPResponse(Element response) {
  StringBuilder text = new StringBuilder();
  String resourceId = XMLPathCtx.createNew().findIn(response).text("//*[local-name() = 'Result']/@ResourceId").get();
  String decision = XMLPathCtx.createNew().findIn(response).text("//*[local-name() = 'Result']/*[local-name() = 'Decision']/text()").get();
  text.append("Resource: \t").append(resourceId ).append("\n");
  text.append("Decision: \t").append(decision).append("\n");
  NodeList obligationNodes = XMLPathCtx.createNew().findIn(response).all("//*[local-name() = 'Obligation']").get();
  for (int i = 0; i < obligationNodes.getLength(); i++) {
    Element obligationElem = (Element) obligationNodes.item(i);
    String oblId = obligationElem.getAttribute("ObligationId");
    String fulfillOn = obligationElem.getAttribute("FulfillOn");
    text.append("Obligation: \t").append(oblId ).append("(fulfillOn:").append(fulfillOn).append(")\n");
    appendAttributeAssignments(text, XMLPathCtx.createNew().findIn(obligationElem).all(".//*[local-name()='AttributeAssignment']").get());
  }
  LOG.debug("PDP response\n" + text);
}

代码示例来源:origin: org.n52.metadata/smarteditor-api

/**
 * Class constructor.
 * <p/>
 * <p>
 * Within this initialization, the classloader searches the xml configuration file <br>
 * called 'catalog_api_factory.xml' that needs to be in the classpath. If not, the <br>
 * initialization of the factory fails.
 * </p>
 */
public BuilderFactory() {
  InputStream is = BuilderFactory.class.getResourceAsStream("/catalog_api_factory.xml");
  if (is != null) {
    mRoot = DOMUtil.createFromStream(is, null);
    xmlPathCtx = XMLPathCtx.createNew();
    xmlPathCtx.addNamespace("api", "http://www.conterra.de/catalog/config/catapi");
  } else {
    LOG.error("Could not find 'catalog_api_factory.xml' in CLASSPATH. BuilderFactory is not available");
    mRoot = null;
  }
}

代码示例来源:origin: org.n52.security/52n-security-facade

public List<SAML2IdPMetadata> getIdPMetadata() {
  XMLPathCtx xpathCtx = XMLPathCtx.createNew().addNamespace("md", "urn:oasis:names:tc:SAML:2.0:metadata");
  NodeList idpList = xpathCtx.findIn(m_federationMetadata).all("//md:IDPSSODescriptor").get();
  List<SAML2IdPMetadata> mdList = new ArrayList<SAML2IdPMetadata>();
  for (int i = 0; i < idpList.getLength(); i++) {
    Element idpSsoDescriptor = (Element) idpList.item(i);
    try {
      SAML2IdPMetadata idPMetadata = SAML2IdPMetadata.createFrom(idpSsoDescriptor);
      mdList.add(idPMetadata);
    } catch (MalformedURLException e) {
      LOG.error("Skipping IDPSSODescriptor element", e);
    }
  }
  return mdList;
}

代码示例来源:origin: org.n52.security/52n-security-enforcement-impl

XMLPathCtx.createNew().addNamespace("ows", "http://www.opengis.net/ows/1.1")
    .addNamespace("sos", "http://www.opengis.net/sos/1.0");

代码示例来源:origin: org.n52.security/52n-security-facade

public PAOSResponse(Element paosResponse) {
  m_paosResponse = paosResponse;
  setXpathCtx(XMLPathCtx.createNew().addNamespace("samlp", "urn:oasis:names:tc:SAML:2.0:protocol").addNamespace(
      "ecp", "urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp"));
}

代码示例来源:origin: org.n52.security/52n-security-core

private Node find(final String xpath) {
  Node node = XMLPathCtx.createNew().addNamespaces(namespaces).findIn(sourceDocument).node(xpath).get();
  if (node == null) {
    throw new IllegalArgumentException("XPath <" + xpath + "> must resolve to an node");
  }
  return (Element) node;
}

代码示例来源:origin: org.n52.security/52n-security-gatekeeper

public Payload replace(String pOldURL, Transferable res, String pEncoding, String pMimeType) {
  Document doc = DOMParser.createNew().parse(new InputSource(res.getPayload().getAsStream()));
  XMLPathCtx ctx = XMLPathCtx.createNew();
  NodeList nodes = ctx.findIn(doc).all("//OnlineResource").get();
  for (int i = 0; i < nodes.getLength(); i++) {
    Node node = nodes.item(i);
    if (node.getParentNode().getParentNode().getLocalName().equals("HTTP")) {
      String name = node.getParentNode().getLocalName();
      node.getParentNode().getParentNode().replaceChild(buildReplacement(name, doc), node.getParentNode());
    }
  }
  // WMS 1.?
  // TODO extend XPath for POST nodes: //DCPType/HTTP/*[self::Get
  // or self::Post]/OnlineResource
  // WFS 1.1
  // TODO extend XPath for POST nodes:
  // //ows:Operation/ows:DCP/ows:HTTP/*[self::ows:Get or
  // self::ows:Post]
  // WFS 1.0
  // TODO add XPath for WFS 1.0.0: //DCPType/HTTP/*[self::Get or
  // self::Post]/@onlineResource
  
  DOMSerializer serializer = DOMSerializer.createNew();
  String response = serializer.serializeToString(doc);
  Pattern lPattern = Pattern.compile(pOldURL.replaceAll("\\?", "\\\\?"));
  Matcher mMatcher = lPattern.matcher(response);
  response = mMatcher.replaceAll(m_gatekeeperURL);
  sLogger.debug("Modified ResponseDocument:\n" + response);
  return new TextualPayload(response, pEncoding);
}

代码示例来源:origin: org.n52.security/52n-security-enforcement-impl

XMLPathCtx.createNew().addNamespace("ows", "http://www.opengis.net/ows/1.1")
    .addNamespace("sos", "http://www.opengis.net/sos/1.0");

代码示例来源:origin: org.n52.security/52n-security-core

/**
 * Creates an instance of this class from an XML file.
 *
 * @param in
 *        a service excpetion XML document
 *
 * @return
 * @throws org.xml.sax.SAXException
 * @throws IOException
 */
public static ServiceException createFromXML(InputSource in) {
  Document excDoc = DOMParser.createNew().parse(in);
  XMLPathCtx pathCtx = XMLPathCtx.createNew();
  String cd = pathCtx.findIn(excDoc).text("//ServiceException/@code").get().trim();
  if (cd.equals(""))
    cd = "No code available";
  String msg = pathCtx.findIn(excDoc).text("//ServiceException/text()").get().trim();
  if (msg.equals(""))
    msg = "No exception information available";
  return new ServiceException(msg, cd);
}

代码示例来源:origin: org.n52.security/52n-security-enforcement-impl

= XMLPathCtx.createNew().addNamespace("ows", "http://www.opengis.net/ows/1.1").addNamespace("wfs",
"http://www.opengis.net/wfs/1.0.0");

代码示例来源:origin: org.n52.security/52n-security-enforcement-impl

XMLPathCtx.createNew().addNamespace("ows", "http://www.opengis.net/ows/1.1").addNamespace("wps",
    "http://www.opengis.net/wps/1.0.0");

代码示例来源:origin: org.n52.security/52n-security-enforcement-impl

XMLPathCtx.createNew().addNamespace("sos", "http://www.opengis.net/sos/1.0")
    .addNamespace("gml", "http://www.opengis.net/gml");

代码示例来源:origin: org.n52.security/52n-security-enforcement-impl

isXMLRequest = true;
ctx
    = XMLPathCtx.createNew().addNamespace("ows", "http://www.opengis.net/ows/1.1").addNamespace("wfs",
    "http://www.opengis.net/wfs/1.0.0").addNamespace("ogc", "http://www.opengis.net/ogc");

代码示例来源:origin: org.n52.security/52n-security-facade

public static SAML2IdPMetadata createFrom(Element idpSsoDescrElement) throws MalformedURLException {
  XMLPathCtx xpathCtx = XMLPathCtx.createNew().addNamespace("md", "urn:oasis:names:tc:SAML:2.0:metadata");
  NodeList nodeList = xpathCtx.findIn(idpSsoDescrElement).all("md:SingleSignOnService").get();
  SAML2IdPMetadata metadata = new SAML2IdPMetadata();
  for (int i = 0; i < nodeList.getLength(); i++) {
    Element ssoService = (Element) nodeList.item(i);
    String binding = ssoService.getAttribute("Binding");
    String location = ssoService.getAttribute("Location");
    metadata.addSSOBinding(binding, new URL(location));
  }
  Element organizationElem = (Element) xpathCtx.findIn(idpSsoDescrElement).node("./../md:Organization").get();
  if (organizationElem == null) {
    String entityID = xpathCtx.findIn(idpSsoDescrElement).text("./../@entityID").get();
    metadata.setOrganisationDisplayName(entityID);
  } else {
    String idpDisplayName = xpathCtx.findIn(organizationElem).text("md:OrganizationDisplayName/text()").get();
    metadata.setOrganisationDisplayName(idpDisplayName);
  }
  return metadata;
}

代码示例来源:origin: org.n52.security/52n-security-enforcement-impl

XMLPathCtx.createNew().addNamespace("ows", "http://www.opengis.net/ows/1.1").addNamespace("wps",
    "http://www.opengis.net/wps/1.0.0");

代码示例来源:origin: org.n52.security/52n-security-wss

private WSSCapabilitiesDocument(Document capsDoc) {
  m_capsDoc = capsDoc;
  m_xPathCtx = XMLPathCtx.createNew();
  m_xPathCtx.addNamespace("authn", "http://www.gdi-nrw.org/authn");
  m_xPathCtx.addNamespace("xlink", "http://www.w3.org/1999/xlink");
  m_xPathCtx.addNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
  m_xPathCtx.addNamespace("licb", "http://www.conterra.de/licb");
  m_xPathCtx.addNamespace("ows", "http://www.opengis.net/ows");
  m_xPathCtx.addNamespace("wss", "http://www.gdi-nrw.org/wss");
  m_editor = new Editor();
  m_parser = new Parser();
}

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