Author: dkulp
Date: Thu Sep 4 10:00:40 2008
New Revision: 692163
URL: http://svn.apache.org/viewvc?rev=692163&view=rev
Log:
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.1.x-fixes/ (props changed)
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 4 10:00:40 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706,691728,692116
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706,691728,692116,692157
Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.1.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.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?rev=692163&r1=692162&r2=692163&view=diff
==============================================================================
---
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
(original)
+++
cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
Thu Sep 4 10:00:40 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