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();
Show replies by date