/** * Create an instance of {@link ArrayOfXPathExpressionType } * */ public ArrayOfXPathExpressionType createArrayOfXPathExpressionType() { return new ArrayOfXPathExpressionType(); }
@Override public ArrayList<String> getUsersfromXpath(ArrayOfXPathExpressionType xpaths, String message) { ArrayList<String> userlist = new ArrayList<String>(); if (xpaths == null || xpaths.getXPathExpressionType() == null || xpaths.getXPathExpressionType().isEmpty()) { return new ArrayList<String>(); } try { InputStream is = new ByteArrayInputStream(message.getBytes(Constants.CHARSET)); Document xmlDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is); for (int i = 0; i < xpaths.getXPathExpressionType().size(); i++) { XPath xpath = XPathFactory.newInstance().newXPath(); javax.xml.xpath.XPathExpression xp = xpath.compile(xpaths.getXPathExpressionType().get(i).getXPath()); String t2 = (String) xp.evaluate(xmlDocument, XPathConstants.STRING); if (!Utility.stringIsNullOrEmpty(t2)) { userlist.add(t2); } } } catch (Exception ex) { log.log(Level.WARN, "Error evaluating xpath expression for consumer identification", ex); } return userlist; }
ui.setXPaths(new ArrayOfXPathExpressionType()); ui.getXPaths().getXPathExpressionType().add(xpath); bits2[4].equals("xpath")){ if (ui.getXPaths()==null) ui.setXPaths(new ArrayOfXPathExpressionType()); XPathExpressionType xpath = new XPathExpressionType(); xpath.setXPath(request.getParameter(key2)); xpath.setIsCertificate("on".equalsIgnoreCase(request.getParameter(bits2[0] + "_" + bits2[1] + "_" + bits2[2] + "_" + bits2[3] + "_x509certxpath"))); ui.getXPaths().getXPathExpressionType().add(xpath); if (ui.getXPaths()!=null && ui.getXPaths().getXPathExpressionType().isEmpty()) ui.setXPaths(null); if (ui.getNamespaces()!=null && ui.getNamespaces().getXMLNamespacePrefixies().isEmpty())
/** * used to determine if we need to save the request or response * * @param pol * @return */ protected boolean containsSLAXpathOrUserIdentXpath(TransactionalWebServicePolicy pol) { boolean found = false; if (pol.getUserIdentification() != null && !pol.getUserIdentification().getUserIdentity().isEmpty()) { for (int i = 0; i < pol.getUserIdentification().getUserIdentity().size(); i++) { if (pol.getUserIdentification().getUserIdentity().get(i).getXPaths() != null && pol.getUserIdentification().getUserIdentity().get(i).getXPaths() != null && !pol.getUserIdentification().getUserIdentity().get(i).getXPaths().getXPathExpressionType().isEmpty()) { found = true; } } } if (found) { return true; } if (pol.getServiceLevelAggrements() != null && !pol.getServiceLevelAggrements().getSLA().isEmpty()) { for (int i = 0; i < pol.getServiceLevelAggrements().getSLA().size(); i++) { found = found || doesSLAContainXpath(pol.getServiceLevelAggrements().getSLA().get(i)); } } return found; }