JBossWS SVN: r8823 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss: ws/core/soap and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-12-02 12:07:57 -0500 (Tue, 02 Dec 2008)
New Revision: 8823
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/XMLContent.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
Log:
[JBPAPP-1461] DOMUtils ThreadLocals not cleared for client calls.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2008-12-02 16:10:53 UTC (rev 8822)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2008-12-02 17:07:57 UTC (rev 8823)
@@ -108,7 +108,7 @@
if (outbound == null)
throw new IllegalStateException("Cannot find property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- MessageContextAssociation.popMessageContext();
+ MessageContextAssociation.popMessageContext(false);
SOAPMessageContextJAXWS resContext = new SOAPMessageContextJAXWS(reqContext);
resContext.setSOAPMessage(null);
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java 2008-12-02 16:10:53 UTC (rev 8822)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java 2008-12-02 17:07:57 UTC (rev 8823)
@@ -28,6 +28,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
+import org.jboss.wsf.common.DOMUtils;
/**
* A thread local association with the current message context
@@ -39,11 +40,11 @@
{
// provide logging
private static Logger log = Logger.getLogger(MessageContextAssociation.class);
-
public static void pushMessageContext(CommonMessageContext msgContext)
{
- if(log.isDebugEnabled()) log.debug("pushMessageContext: " + msgContext + " (Thread " +Thread.currentThread().getName()+ ")");
+ if (log.isDebugEnabled())
+ log.debug("pushMessageContext: " + msgContext + " (Thread " + Thread.currentThread().getName() + ")");
Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
if (stack == null)
{
@@ -66,13 +67,24 @@
public static CommonMessageContext popMessageContext()
{
+ return popMessageContext(true);
+ }
+
+ public static CommonMessageContext popMessageContext(boolean clearDOMIfEmpty)
+ {
CommonMessageContext msgContext = null;
Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
if (stack != null && stack.isEmpty() == false)
{
msgContext = stack.pop();
+ if (stack.isEmpty() == true && clearDOMIfEmpty == true)
+ {
+ DOMUtils.clearThreadLocals();
+ }
}
- if(log.isDebugEnabled()) log.debug("popMessageContext: " + msgContext +" (Thread " +Thread.currentThread().getName()+ ")");
+ if (log.isDebugEnabled())
+ log.debug("popMessageContext: " + msgContext + " (Thread " + Thread.currentThread().getName() + ")");
return msgContext;
}
+
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/XMLContent.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2008-12-02 16:10:53 UTC (rev 8822)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2008-12-02 17:07:57 UTC (rev 8823)
@@ -73,6 +73,7 @@
// The well formed XML content of this element.
private XMLFragment xmlFragment;
+ private Document document = DOMUtils.getOwnerDocument();
protected XMLContent(SOAPContentElement container)
{
@@ -329,10 +330,29 @@
short childType = child.getNodeType();
if (childType == Node.ELEMENT_NODE)
{
- SOAPElement soapElement = soapFactory.createElement((Element)child);
- container.addChildElement(soapElement);
- if (Constants.NAME_XOP_INCLUDE.equals(qname) || container.isXOPParameter())
- XOPContext.inlineXOPData(soapElement);
+
+ boolean setOwnerDocument = (DOMUtils.peekOwnerDocument() == null);
+
+ try
+ {
+ if (setOwnerDocument)
+ {
+ DOMUtils.setOwnerDocument(document);
+ }
+ SOAPElement soapElement = soapFactory.createElement((Element)child);
+ container.addChildElement(soapElement);
+ if (Constants.NAME_XOP_INCLUDE.equals(qname) || container.isXOPParameter())
+ XOPContext.inlineXOPData(soapElement);
+
+ }
+ finally
+ {
+ if (setOwnerDocument)
+ {
+ DOMUtils.clearThreadLocals();
+ }
+ }
+
}
else if (childType == Node.TEXT_NODE)
{
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2008-12-02 16:10:53 UTC (rev 8822)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2008-12-02 17:07:57 UTC (rev 8823)
@@ -81,6 +81,9 @@
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Endpoint.EndpointState;
import org.jboss.wsf.spi.invocation.InvocationContext;
@@ -88,10 +91,6 @@
import org.jboss.wsf.spi.management.EndpointMetrics;
import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.common.DOMWriter;
-import org.jboss.wsf.common.DOMUtils;
import org.w3c.dom.Document;
/**
@@ -331,7 +330,6 @@
// clear thread local storage
ThreadLocalAssociation.clear();
- DOMUtils.clearThreadLocals();
}
}
16 years, 1 month
JBossWS SVN: r8822 - common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-12-02 11:10:53 -0500 (Tue, 02 Dec 2008)
New Revision: 8822
Modified:
common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common/DOMUtils.java
Log:
[JBPAPP-1461] DOMUtils ThreadLocals not cleared for client calls.
Modified: common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common/DOMUtils.java
===================================================================
--- common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common/DOMUtils.java 2008-12-01 17:41:17 UTC (rev 8821)
+++ common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common/DOMUtils.java 2008-12-02 16:10:53 UTC (rev 8822)
@@ -551,6 +551,17 @@
return (parent instanceof Element ? (Element)parent : null);
}
+ /** Peek at the owner document without creating a new one if not set. */
+ public static Document peekOwnerDocument()
+ {
+ return documentThreadLocal.get();
+ }
+
+ public static void setOwnerDocument(Document doc)
+ {
+ documentThreadLocal.set(doc);
+ }
+
/** Get the owner document that is associated with the current thread */
public static Document getOwnerDocument()
{
16 years, 1 month
JBossWS SVN: r8821 - in stack/native/trunk/modules/core/src/main/java/org/jboss: ws/core/jaxws/spi and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-12-01 12:41:17 -0500 (Mon, 01 Dec 2008)
New Revision: 8821
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
Log:
[JBWS-2304] DOMUtils ThreadLocals not cleared for client calls.
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2008-12-01 17:39:26 UTC (rev 8820)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2008-12-01 17:41:17 UTC (rev 8821)
@@ -109,7 +109,7 @@
if (outbound == null)
throw new IllegalStateException("Cannot find property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- MessageContextAssociation.popMessageContext();
+ MessageContextAssociation.popMessageContext(false);
SOAPMessageContextJAXWS resContext = new SOAPMessageContextJAXWS(reqContext);
resContext.setSOAPMessage(null);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2008-12-01 17:39:26 UTC (rev 8820)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java 2008-12-01 17:41:17 UTC (rev 8821)
@@ -39,6 +39,7 @@
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
import org.jboss.util.NotImplementedException;
+import org.jboss.wsf.common.DOMUtils;
import org.w3c.dom.Element;
/**
@@ -60,6 +61,7 @@
public ServiceDelegate createServiceDelegate(URL wsdlLocation, QName serviceName, Class serviceClass)
{
ServiceDelegateImpl delegate = new ServiceDelegateImpl(wsdlLocation, serviceName, serviceClass);
+ DOMUtils.clearThreadLocals();
return delegate;
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java 2008-12-01 17:39:26 UTC (rev 8820)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageContextAssociation.java 2008-12-01 17:41:17 UTC (rev 8821)
@@ -26,6 +26,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
+import org.jboss.wsf.common.DOMUtils;
/**
* A thread local association with the current message context
@@ -37,11 +38,11 @@
{
// provide logging
private static Logger log = Logger.getLogger(MessageContextAssociation.class);
-
public static void pushMessageContext(CommonMessageContext msgContext)
{
- if(log.isDebugEnabled()) log.debug("pushMessageContext: " + msgContext + " (Thread " +Thread.currentThread().getName()+ ")");
+ if (log.isDebugEnabled())
+ log.debug("pushMessageContext: " + msgContext + " (Thread " + Thread.currentThread().getName() + ")");
Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
if (stack == null)
{
@@ -64,13 +65,24 @@
public static CommonMessageContext popMessageContext()
{
+ return popMessageContext(true);
+ }
+
+ public static CommonMessageContext popMessageContext(boolean clearDOMIfEmpty)
+ {
CommonMessageContext msgContext = null;
Stack<CommonMessageContext> stack = ThreadLocalAssociation.localMsgContextAssoc().get();
if (stack != null && stack.isEmpty() == false)
{
msgContext = stack.pop();
+ if (stack.isEmpty() == true && clearDOMIfEmpty == true)
+ {
+ DOMUtils.clearThreadLocals();
+ }
}
- if(log.isDebugEnabled()) log.debug("popMessageContext: " + msgContext +" (Thread " +Thread.currentThread().getName()+ ")");
+ if (log.isDebugEnabled())
+ log.debug("popMessageContext: " + msgContext + " (Thread " + Thread.currentThread().getName() + ")");
return msgContext;
}
+
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2008-12-01 17:39:26 UTC (rev 8820)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/XMLContent.java 2008-12-01 17:41:17 UTC (rev 8821)
@@ -71,6 +71,7 @@
// The well formed XML content of this element.
private XMLFragment xmlFragment;
+ private Document document = DOMUtils.getOwnerDocument();
protected XMLContent(SOAPContentElement container)
{
@@ -327,10 +328,29 @@
short childType = child.getNodeType();
if (childType == Node.ELEMENT_NODE)
{
- SOAPElement soapElement = soapFactory.createElement((Element)child);
- container.addChildElement(soapElement);
- if (Constants.NAME_XOP_INCLUDE.equals(qname) || container.isXOPParameter())
- XOPContext.inlineXOPData(soapElement);
+
+ boolean setOwnerDocument = (DOMUtils.peekOwnerDocument() == null);
+
+ try
+ {
+ if (setOwnerDocument)
+ {
+ DOMUtils.setOwnerDocument(document);
+ }
+ SOAPElement soapElement = soapFactory.createElement((Element)child);
+ container.addChildElement(soapElement);
+ if (Constants.NAME_XOP_INCLUDE.equals(qname) || container.isXOPParameter())
+ XOPContext.inlineXOPData(soapElement);
+
+ }
+ finally
+ {
+ if (setOwnerDocument)
+ {
+ DOMUtils.clearThreadLocals();
+ }
+ }
+
}
else if (childType == Node.TEXT_NODE)
{
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2008-12-01 17:39:26 UTC (rev 8820)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/RequestHandlerImpl.java 2008-12-01 17:41:17 UTC (rev 8821)
@@ -86,6 +86,11 @@
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.common.IOUtils;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Endpoint.EndpointState;
import org.jboss.wsf.spi.invocation.InvocationContext;
@@ -93,11 +98,6 @@
import org.jboss.wsf.spi.management.EndpointMetrics;
import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.management.ServerConfigFactory;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.common.DOMWriter;
-import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.common.IOUtils;
import org.w3c.dom.Document;
import com.sun.xml.fastinfoset.dom.DOMDocumentSerializer;
@@ -337,7 +337,6 @@
}
finally
{
-
// Cleanup outbound attachments
CommonMessageContext.cleanupAttachments(MessageContextAssociation.peekMessageContext());
@@ -346,7 +345,6 @@
// clear thread local storage
ThreadLocalAssociation.clear();
- DOMUtils.clearThreadLocals();
try
{
outStream.close();
16 years, 1 month
JBossWS SVN: r8820 - common/trunk/src/main/java/org/jboss/wsf/common.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2008-12-01 12:39:26 -0500 (Mon, 01 Dec 2008)
New Revision: 8820
Modified:
common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java
Log:
[JBWS-2304] DOMUtils ThreadLocals not cleared for client calls.
Modified: common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java 2008-11-28 14:32:57 UTC (rev 8819)
+++ common/trunk/src/main/java/org/jboss/wsf/common/DOMUtils.java 2008-12-01 17:39:26 UTC (rev 8820)
@@ -660,6 +660,17 @@
return (parent instanceof Element ? (Element)parent : null);
}
+ /** Peek at the owner document without creating a new one if not set. */
+ public static Document peekOwnerDocument()
+ {
+ return documentThreadLocal.get();
+ }
+
+ public static void setOwnerDocument(Document doc)
+ {
+ documentThreadLocal.set(doc);
+ }
+
/** Get the owner document that is associated with the current thread */
public static Document getOwnerDocument()
{
16 years, 1 month