Author: dkulp Date: Fri Sep 5 09:30:59 2008 New Revision: 692479 URL: http://svn.apache.org/viewvc?rev=692479&view=rev Log: Merged revisions 692163 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes
................ r692163 | dkulp | 2008-09-04 13:00:40 -0400 (Thu, 04 Sep 2008) | 9 lines Merged revisions 692157 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r692157 | dkulp | 2008-09-04 12:53:01 -0400 (Thu, 04 Sep 2008) | 2 lines Don't use NodeList, walking siblings is faster. ........ ................ Modified: cxf/branches/2.0.x-fixes/ (props changed) cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Sep 5 09:30:59 2008 @@ -1,3 +1,3 @@ -/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162,692468 -/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692466 +/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468 +/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466 /incubator/cxf/trunk:434594-651668 Propchange: cxf/branches/2.0.x-fixes/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Sep 5 09:30:59 2008 @@ -1 +1 @@ -/cxf/branches/2.1.x-fixes:1-686313,686315-686332,686334-686346,686348-686828,687097,687464-687465,689109,689112,689122,690841,691316,691357,691491,691711,691715,691745,692162,692344,692468 +/cxf/branches/2.1.x-fixes:1-686313,686315-686332,686334-686346,686348-686828,687097,687464-687465,689109,689112,689122,690841,691316,691357,691491,691711,691715,691745,692162-692163,692344,692468 Modified: cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?rev=692479&r1=692478&r2=692479&view=diff ============================================================================== --- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java (original) +++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java Fri Sep 5 09:30:59 2008 @@ -47,6 +47,7 @@ import org.apache.cxf.databinding.DataBinding; import org.apache.cxf.headers.HeaderManager; import org.apache.cxf.headers.HeaderProcessor; +import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.phase.Phase; import org.apache.cxf.staxutils.PartialXMLStreamReader; import org.apache.cxf.staxutils.StaxUtils; @@ -111,66 +112,62 @@ .getLocalPart()); for (int i = 0; i < headerEls.getLength(); i++) { Node currentHead = headerEls.item(i); - Node node = currentHead; - NodeList heads = node.getChildNodes(); - int len = heads.getLength(); - for (int x = 0; x < len; x++) { - node = (Node)heads.item(x); - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element hel = (Element)node; - // Need to add any attributes that are present on the parent element - // which otherwise would be lost. - if (currentHead.hasAttributes()) { - NamedNodeMap nnp = currentHead.getAttributes(); - for (int ct = 0; ct < nnp.getLength(); ct++) { - Node attr = nnp.item(ct); - Node headerAttrNode = hel.hasAttributes() - ? hel.getAttributes().getNamedItemNS( - attr.getNamespaceURI(), attr.getLocalName()) - : null; - - if (headerAttrNode == null) { - Attr attribute = hel.getOwnerDocument().createAttributeNS( - attr.getNamespaceURI(), - attr.getNodeName()); - attribute.setNodeValue(attr.getNodeValue()); - hel.setAttributeNodeNS(attribute); - } + Element hel = DOMUtils.getFirstElement(currentHead); + while (hel != null) { + // Need to add any attributes that are present on the parent element + // which otherwise would be lost. + if (currentHead.hasAttributes()) { + NamedNodeMap nnp = currentHead.getAttributes(); + for (int ct = 0; ct < nnp.getLength(); ct++) { + Node attr = nnp.item(ct); + Node headerAttrNode = hel.hasAttributes() + ? hel.getAttributes().getNamedItemNS( + attr.getNamespaceURI(), attr.getLocalName()) + : null; + + if (headerAttrNode == null) { + Attr attribute = hel.getOwnerDocument().createAttributeNS( + attr.getNamespaceURI(), + attr.getNodeName()); + attribute.setNodeValue(attr.getNodeValue()); + hel.setAttributeNodeNS(attribute); } } - + } + // System.out.println("READHEADERSINTERCEPTOR : node name : " // + node.getLocalName() + " namespace URI" + node.getNamespaceURI()); - HeaderProcessor p = bus.getExtension(HeaderManager.class) - .getHeaderProcessor(hel.getNamespaceURI()); + HeaderProcessor p = bus.getExtension(HeaderManager.class) + .getHeaderProcessor(hel.getNamespaceURI()); - Object obj; - DataBinding dataBinding = null; - if (p == null || p.getDataBinding() == null) { - obj = node; - } else { - obj = p.getDataBinding().createReader(Node.class).read(node); - } - //TODO - add the interceptors - - SoapHeader shead = new SoapHeader(new QName(node.getNamespaceURI(), - node.getLocalName()), - obj, - dataBinding); - String mu = hel.getAttributeNS(soapVersion.getNamespace(), - soapVersion.getAttrNameMustUnderstand()); - String act = hel.getAttributeNS(soapVersion.getNamespace(), - soapVersion.getAttrNameRole()); - - if (!StringUtils.isEmpty(act)) { - shead.setActor(act); - } - shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu)); - //mark header as inbound header.(for distinguishing between the direction to - //avoid piggybacking of headers from request->server->response. - shead.setDirection(SoapHeader.Direction.DIRECTION_IN); - message.getHeaders().add(shead); - } + Object obj; + DataBinding dataBinding = null; + if (p == null || p.getDataBinding() == null) { + obj = hel; + } else { + obj = p.getDataBinding().createReader(Node.class).read(hel); + } + //TODO - add the interceptors + + SoapHeader shead = new SoapHeader(new QName(hel.getNamespaceURI(), + hel.getLocalName()), + obj, + dataBinding); + String mu = hel.getAttributeNS(soapVersion.getNamespace(), + soapVersion.getAttrNameMustUnderstand()); + String act = hel.getAttributeNS(soapVersion.getNamespace(), + soapVersion.getAttrNameRole()); + + if (!StringUtils.isEmpty(act)) { + shead.setActor(act); + } + shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu)); + //mark header as inbound header.(for distinguishing between the direction to + //avoid piggybacking of headers from request->server->response. + shead.setDirection(SoapHeader.Direction.DIRECTION_IN); + message.getHeaders().add(shead); + + hel = DOMUtils.getNextElement(hel); } } //advance to just outside the <soap:body> opening tag, but not
