/* (non-Javadoc) * @see org.soulwing.cas.client.jdom.AbstractResponseMappingStrategy#mapSuccessResponse(org.jdom.Element) */ public ValidationResponse mapSuccessResponse(Element element) { ProxyValidationSuccessResponse response = new ProxyValidationSuccessResponse( (ServiceValidationResponse) serviceValidateMappingStrategy.mapResponse(element.getParentElement())); response.setProxies(getProxies(JdomUtil.getChild(element, ProtocolConstants.PROXIES))); return response; }
/** * Sets the list of proxies for a CAS response from the given <code>element</code> * * @param element JDOM element which is expected to contain the proxies element. * @throws ProtocolViolationException if <code>element</code> does not contain the proxies * element. */ @SuppressWarnings("unchecked") private List getProxies(Element element) { List proxies = new ArrayList(); if (element != null) { List proxyElementList = JdomUtil.getChildren(element, ProtocolConstants.PROXY); if (proxyElementList.size() == 0) { throw new ProtocolViolationException("Expected at least one proxy"); } for (Iterator i = proxyElementList.iterator(); i.hasNext(); ) { Element proxy = (Element) i.next(); proxies.add(proxy.getTextTrim()); } } return proxies; }