JBossWS SVN: r14105 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 12:35:10 -0400 (Thu, 14 Apr 2011)
New Revision: 14105
Removed:
stack/native/branches/asoldano/
Log:
Removing branch not used anymore
13 years
JBossWS SVN: r14104 - in stack/native/trunk: modules/core and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 12:31:06 -0400 (Thu, 14 Apr 2011)
New Revision: 14104
Modified:
stack/native/trunk/
stack/native/trunk/modules/core/pom.xml
stack/native/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
stack/native/trunk/pom.xml
Log:
[JBWS-3266] Update to javax.xml.stream:stax-api:1.0-2
Property changes on: stack/native/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/asoldano:14057
/stack/native/branches/ropalka:13836-13879
+ /stack/native/branches/asoldano:14057,14069
/stack/native/branches/ropalka:13836-13879
Modified: stack/native/trunk/modules/core/pom.xml
===================================================================
--- stack/native/trunk/modules/core/pom.xml 2011-04-14 16:28:19 UTC (rev 14103)
+++ stack/native/trunk/modules/core/pom.xml 2011-04-14 16:31:06 UTC (rev 14104)
@@ -130,6 +130,10 @@
<artifactId>jettison</artifactId>
</dependency>
<dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.spec.javax.xml.bind</groupId>
<artifactId>jboss-jaxb-api_2.2_spec</artifactId>
</dependency>
Modified: stack/native/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/native/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2011-04-14 16:28:19 UTC (rev 14103)
+++ stack/native/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2011-04-14 16:31:06 UTC (rev 14104)
@@ -70,7 +70,7 @@
<include>org.jboss.ws:jbossws-spi:jar</include>
<include>org.codehaus.jettison:jettison:jar</include>
<include>com.sun.xml.ws:policy:jar</include>
- <include>stax:stax-api:jar</include>
+ <include>javax.xml.stream:stax-api:jar</include>
<include>org.jvnet.staxex:stax-ex:jar</include>
<include>com.sun.xml.stream.buffer:streambuffer:jar</include>
<include>wsdl4j:wsdl4j:jar</include>
Modified: stack/native/trunk/pom.xml
===================================================================
--- stack/native/trunk/pom.xml 2011-04-14 16:28:19 UTC (rev 14103)
+++ stack/native/trunk/pom.xml 2011-04-14 16:31:06 UTC (rev 14104)
@@ -73,6 +73,7 @@
<sun.fastinfoset.version>1.2.2</sun.fastinfoset.version>
<sun.jaxws.version>2.2</sun.jaxws.version>
<sun.policy.version>2.0-b01</sun.policy.version>
+ <stax.api.version>1.0-2</stax.api.version>
<woodstox.version>3.2.6</woodstox.version>
<wscommons.policy.version>1.0</wscommons.policy.version>
<wsdl4j.version>1.6.2</wsdl4j.version>
@@ -320,6 +321,11 @@
<version>${juddi.version}</version>
</dependency>
<dependency>
+ <groupId>javax.xml.stream</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>${stax.api.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>${codehaus.jettison.version}</version>
13 years
JBossWS SVN: r14103 - in stack/native/trunk: modules/core/src/main/java/javax/xml/ws/addressing and 21 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 12:28:19 -0400 (Thu, 14 Apr 2011)
New Revision: 14103
Added:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/SecurityActions.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java
Removed:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java
Modified:
stack/native/trunk/
stack/native/trunk/modules/core/src/main/java/javax/xml/ws/addressing/AddressingBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyTransportHandler.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EagerInitializeDeploymentAspect.java
stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/native/jbossws-native-core/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/spi/main/module.xml
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-interop.xml
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
stack/native/trunk/modules/testsuite/native-tests/scripts/build-samples-jaxws.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1909/TestEndpointImpl.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2319/SOAPHandler.java
Log:
[JBWS-3224][JBWS-3265] Isolate deployment classloader from ws server integration
Property changes on: stack/native/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /stack/native/branches/ropalka:13836-13879
+ /stack/native/branches/asoldano:14057
/stack/native/branches/ropalka:13836-13879
Modified: stack/native/trunk/modules/core/src/main/java/javax/xml/ws/addressing/AddressingBuilder.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/javax/xml/ws/addressing/AddressingBuilder.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/javax/xml/ws/addressing/AddressingBuilder.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -77,22 +77,29 @@
private static AddressingBuilder newInstance(String className, ClassLoader classLoader)
{
+ Class cls = null;
try
{
- Class cls;
- if (classLoader == null)
+ cls = loadClass(classLoader, className);
+ }
+ catch (Exception x)
+ {
+ //ignore
+ }
+ if (cls == null)
+ {
+ try
{
cls = Class.forName(className);
}
- else
+ catch (ClassNotFoundException x)
{
- cls = loadClass(classLoader, className);
+ throw new AddressingException("Provider " + className + " not found", x);
}
- return (AddressingBuilder)cls.newInstance();
}
- catch (ClassNotFoundException x)
+ try
{
- throw new AddressingException("Provider " + className + " not found", x);
+ return (AddressingBuilder)cls.newInstance();
}
catch (Exception x)
{
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyTransportHandler.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyTransportHandler.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/client/transport/NettyTransportHandler.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -28,8 +28,6 @@
import java.security.AccessController;
import java.util.Map;
import java.util.StringTokenizer;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
import org.jboss.logging.Logger;
import org.jboss.netty.bootstrap.ClientBootstrap;
@@ -37,7 +35,6 @@
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelPipelineFactory;
-import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
import org.jboss.netty.handler.codec.http.HttpHeaders;
import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.ws.Constants;
@@ -90,7 +87,7 @@
keepAliveProp = true;
}
factoryProvider = (ClientSocketChannelFactoryProvider)ServiceLoader.loadService(ClientSocketChannelFactoryProvider.class.getName(),
- DefaultClientSocketChannelFactoryProvider.class.getName());
+ DefaultClientSocketChannelFactoryProvider.class.getName(), NettyTransportHandler.class.getClassLoader());
}
private NettyTransportHandler(URL url, ChannelPipelineFactory pipelineFactory)
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -80,6 +80,6 @@
*/
public static JAXBContextFactory newInstance()
{
- return (JAXBContextFactory)ServiceLoader.loadService(JAXBContextFactory.class.getName(), DEFAULT_JAXB_CONTEXT_FACTORY);
+ return (JAXBContextFactory)ServiceLoader.loadService(JAXBContextFactory.class.getName(), DEFAULT_JAXB_CONTEXT_FACTORY, JAXBContextFactory.class.getClassLoader());
}
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -27,7 +27,6 @@
import javax.xml.rpc.encoding.TypeMapping;
import javax.xml.soap.Detail;
import javax.xml.soap.DetailEntry;
-import javax.xml.soap.MessageFactory;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConstants;
@@ -47,11 +46,11 @@
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.CommonSOAPFaultException;
-import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.binding.AbstractDeserializerFactory;
+import org.jboss.ws.core.binding.AbstractSerializerFactory;
+import org.jboss.ws.core.binding.BindingException;
import org.jboss.ws.core.binding.DeserializerSupport;
import org.jboss.ws.core.binding.SerializationContext;
-import org.jboss.ws.core.binding.AbstractSerializerFactory;
import org.jboss.ws.core.binding.SerializerSupport;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
@@ -67,8 +66,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import com.ibm.wsdl.extensions.soap12.SOAP12Constants;
-
/**
* Helper methods to translate between SOAPFault and SOAPFaultException
* as well as between Exception and SOAPMessage containing a fault.
@@ -329,8 +326,7 @@
private static SOAPMessageImpl createSOAPMessage() throws SOAPException
{
- MessageFactoryImpl factory = (MessageFactoryImpl)MessageFactory.newInstance();
-
+ MessageFactoryImpl factory = new MessageFactoryImpl();
if (isSOAP12() == true)
{
factory.setEnvNamespace(Constants.NS_SOAP12_ENV);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/LogicalMessageImpl.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -45,7 +45,6 @@
import org.jboss.ws.core.soap.Style;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.spi.util.ServiceLoader;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -112,7 +111,7 @@
try
{
soapBody.removeContents();
- EnvelopeBuilder envBuilder = (EnvelopeBuilder)ServiceLoader.loadService(EnvelopeBuilder.class.getName(), EnvelopeBuilderDOM.class.getName());
+ EnvelopeBuilder envBuilder = new EnvelopeBuilderDOM();
envBuilder.setStyle(style);
Element domBodyElement = DOMUtils.sourceToElement(source);
envBuilder.buildBodyElementRpc(soapBody, domBodyElement);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -142,9 +142,7 @@
log.debug("Importing resource file: " + impResourceFile.getCanonicalPath());
String wsdlLocFilePath = wsdlLocFile.getParentFile().getCanonicalPath();
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- ServerConfig serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
- String wsdlDataLoc = serverConfig.getServerDataDir().getCanonicalPath() + File.separatorChar + "wsdl";
+ String wsdlDataLoc = config.getServerDataDir().getCanonicalPath() + File.separatorChar + "wsdl";
//allow wsdl file's parent or server's data/wsdl or overriden wsdl publish directories only
String resourceAbsPath = impResourceFile.getCanonicalPath();
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -288,7 +288,8 @@
}
else
{
- envBuilder = (EnvelopeBuilder)ServiceLoader.loadService(EnvelopeBuilder.class.getName(), null);
+ //the classloader for jbossws-native-core has enough visibility to get the proper envelope builder
+ envBuilder = (EnvelopeBuilder)ServiceLoader.loadService(EnvelopeBuilder.class.getName(), null, this.getClass().getClassLoader());
}
//if inputstream is empty, no need to build
if (inputStream.markSupported()) {
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -280,7 +280,7 @@
{
Document oldDoc = DOMUtils.peekOwnerDocument();
DOMUtils.setOwnerDocument(element.getOwnerDocument());
- soapElement = (SOAPElementImpl) SOAPFactoryImpl.newInstance().createElement((Element) (soapElement.domNode));
+ soapElement = (SOAPElementImpl) new SOAPFactoryImpl().createElement((Element) (soapElement.domNode));
DOMUtils.setOwnerDocument(oldDoc);
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -32,7 +32,6 @@
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
@@ -248,9 +247,9 @@
public void writeHeaders(SOAPMessage message) throws AddressingException
{
- try
- {
- SOAPFactoryImpl factory = (SOAPFactoryImpl)SOAPFactory.newInstance();
+ try
+ {
+ SOAPFactoryImpl factory = new SOAPFactoryImpl();
SOAPHeader soapHeader = message.getSOAPHeader();
if (soapHeader == null)
@@ -401,7 +400,7 @@
SOAPElement child = null;
try
{
- SOAPFactoryImpl factory = (SOAPFactoryImpl)SOAPFactory.newInstance();
+ SOAPFactoryImpl factory = new SOAPFactoryImpl();
if (obj instanceof Element)
{
child = factory.createElement((Element)obj);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderEJB3.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -28,6 +28,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DelegateClassLoader;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -63,7 +64,7 @@
ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader();
if(null == runtimeClassLoader)
throw new IllegalArgumentException("Runtime loader cannot be null");
- wsMetaData.setClassLoader(runtimeClassLoader);
+ wsMetaData.setClassLoader(new DelegateClassLoader(runtimeClassLoader, SecurityActions.getContextClassLoader()));
// The container objects below provide access to all of the ejb metadata
EJBArchiveMetaData apMetaData = dep.getAttachment(EJBArchiveMetaData.class);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilderJSE.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -23,6 +23,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DelegateClassLoader;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -52,7 +53,7 @@
ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader();
if(null == runtimeClassLoader)
throw new IllegalArgumentException("Runtime classloader cannot be null");
- wsMetaData.setClassLoader(runtimeClassLoader);
+ wsMetaData.setClassLoader(new DelegateClassLoader(runtimeClassLoader, SecurityActions.getContextClassLoader()));
// For every bean
for (Endpoint ep : dep.getService().getEndpoints())
Copied: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/SecurityActions.java (from rev 14057, stack/native/branches/asoldano/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/SecurityActions.java)
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/SecurityActions.java (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/SecurityActions.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.builder.jaxws;
+
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Security actions for this package
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Jun-2009
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param cl the classloader
+ * @return previous context classloader
+ * @throws Throwable for any error
+ */
+ static ClassLoader setContextClassLoader(final ClassLoader cl)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ ClassLoader result = Thread.currentThread().getContextClassLoader();
+ if (cl != null)
+ Thread.currentThread().setContextClassLoader(cl);
+ return result;
+ }
+ else
+ {
+ try
+ {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<ClassLoader>() {
+ public ClassLoader run() throws Exception
+ {
+ try
+ {
+ ClassLoader result = Thread.currentThread().getContextClassLoader();
+ if (cl != null)
+ Thread.currentThread().setContextClassLoader(cl);
+ return result;
+ }
+ catch (Exception e)
+ {
+ throw e;
+ }
+ catch (Error e)
+ {
+ throw e;
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException("Error setting context classloader", e);
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw new RuntimeException("Error running privileged action", e.getCause());
+ }
+ }
+ }
+
+ static URL getResource(final ClassLoader cl, final String filename)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return cl.getResource(filename);
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run()
+ {
+ return cl.getResource(filename);
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/config/JBossWSConfigFactory.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -24,6 +24,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
@@ -53,19 +55,27 @@
private static String URN_JAXRPC_CONFIG = "urn:jboss:jaxrpc-config:2.0";
private static String URN_JAXWS_CONFIG = "urn:jboss:jaxws-config:2.0";
+
+ private ClassLoader loader;
// Hide constructor
- private JBossWSConfigFactory()
+ private JBossWSConfigFactory(ClassLoader loader)
{
+ this.loader = loader;
}
/** Create a new instance of the factory
*/
public static JBossWSConfigFactory newInstance()
{
- return new JBossWSConfigFactory();
+ return new JBossWSConfigFactory(getContextClassLoader());
}
+ public static JBossWSConfigFactory newInstance(ClassLoader loader)
+ {
+ return new JBossWSConfigFactory(loader);
+ }
+
public Object parse(URL configURL)
{
if(log.isDebugEnabled()) log.debug("parse: " + configURL);
@@ -184,7 +194,7 @@
{
try
{
- configURL = new ResourceLoaderAdapter().findChild(configFile).toURL();
+ configURL = new ResourceLoaderAdapter(loader).findChild(configFile).toURL();
}
catch (IOException ex)
{
@@ -197,4 +207,27 @@
return configURL;
}
+
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ private static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -914,7 +914,7 @@
if (log.isDebugEnabled())
log.debug("Create new config [name=" + configName + ",file=" + configFile + "]");
- JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance();
+ JBossWSConfigFactory factory = JBossWSConfigFactory.newInstance(getClassLoader());
List<RMPortConfig> rmPortMetaData = null;
if (base != null)
{
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EagerInitializeDeploymentAspect.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EagerInitializeDeploymentAspect.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EagerInitializeDeploymentAspect.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -21,6 +21,7 @@
*/
package org.jboss.wsf.stack.jbws;
+import org.jboss.ws.core.utils.DelegateClassLoader;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.wsf.common.integration.AbstractDeploymentAspect;
import org.jboss.wsf.spi.deployment.Deployment;
@@ -44,7 +45,7 @@
if(null == runtimeClassLoader)
throw new IllegalArgumentException("Runtime classloader may not be null");
- umd.setClassLoader(runtimeClassLoader);
+ umd.setClassLoader(new DelegateClassLoader(runtimeClassLoader, SecurityActions.getContextClassLoader()));
umd.eagerInitialize();
}
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/EndpointServlet.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -21,17 +21,23 @@
*/
package org.jboss.wsf.stack.jbws;
+import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import org.jboss.logging.Logger;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.ServletDelegate;
import org.jboss.wsf.spi.management.EndpointResolver;
import org.jboss.wsf.common.injection.InjectionHelper;
import org.jboss.wsf.common.injection.PreDestroyHolder;
import org.jboss.wsf.common.servlet.AbstractEndpointServlet;
import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
/**
* A Native endpoint servlet that is installed for every web service endpoint
@@ -39,7 +45,7 @@
* @author heiko.braun(a)jboss.com
* @author richard.opalka(a)jboss.com
*/
-public final class EndpointServlet extends AbstractEndpointServlet
+public final class EndpointServlet extends AbstractEndpointServlet implements ServletDelegate
{
// provide logging
@@ -114,4 +120,46 @@
}
}
+ @Override
+ public void doHead(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doHead(request, response);
+ }
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doGet(request, response);
+ }
+
+ @Override
+ public void doPost(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doPost(request, response);
+ }
+
+ @Override
+ public void doPut(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doPut(request, response);
+ }
+
+ @Override
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doDelete(request, response);
+ }
+
+ @Override
+ public void service(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.service(request, response);
+ }
+
}
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml 2011-04-14 16:28:19 UTC (rev 14103)
@@ -33,8 +33,17 @@
<module name="org.jboss.ws.api" export="true"/>
<module name="org.jboss.ws.spi" export="true"/>
<module name="org.jboss.ws.common" export="true"/>
+ <module name="org.jboss.ws.jaxws-client" services="export" export="true"/>
<module name="org.jboss.ws.native.jbossws-native-factories" services="export" export="true"/>
- <module name="org.jboss.ws.native.jbossws-native-core" services="export" export="true"/>
+ <module name="org.jboss.ws.native.jbossws-native-core" services="export" export="true">
+ <imports>
+ <include path="META-INF"/>
+ </imports>
+ <exports>
+ <include path="META-INF"/>
+ </exports>
+ </module>
+ <module name="org.jboss.ws.native.jbossws-native-services" services="export" export="true"/>
<module name="org.apache.xalan" services="export" export="true"/>
<module name="org.apache.xerces" services="export" export="true"/>
<module name="org.jboss.as.webservices" services="export" export="true"/>
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml 2011-04-14 16:28:19 UTC (rev 14103)
@@ -30,6 +30,9 @@
<dependencies>
<module name="javax.api"/>
+ <module name="com.sun.xml.messaging.saaj" services="export" export="true"/>
+ <module name="javax.xml.ws.api"/>
<module name="org.jboss.logging"/>
+ <module name="org.jboss.modules"/>
</dependencies>
</module>
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/native/jbossws-native-core/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/native/jbossws-native-core/main/module.xml 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/native/jbossws-native-core/main/module.xml 2011-04-14 16:28:19 UTC (rev 14103)
@@ -51,7 +51,7 @@
<module name="org.jboss.ws.api" />
<module name="org.jboss.ws.spi" />
<module name="org.jboss.ws.common" />
- <module name="org.jboss.ws.jaxws-client" />
+ <module name="org.jboss.ws.jaxws-client" services="import"/>
<module name="org.jboss.ws.native.jbossws-native-factories" services="import"/>
<module name="org.jboss.ws.native.jbossws-native-services" services="import"/>
<module name="org.jboss.common-core" />
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/spi/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/spi/main/module.xml 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/spi/main/module.xml 2011-04-14 16:28:19 UTC (rev 14103)
@@ -30,6 +30,7 @@
<dependencies>
<module name="javax.api"/>
+ <module name="javax.servlet.api"/>
<module name="javax.xml.stream.api"/>
<module name="javax.xml.ws.api"/>
<module name="org.jboss.logging"/>
Modified: stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-interop.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-interop.xml 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-interop.xml 2011-04-14 16:28:19 UTC (rev 14103)
@@ -115,6 +115,9 @@
<fileset dir="${tests.output.dir}/test-resources/interop/wsse/">
<include name="*.*"/>
</fileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jbossws-interop-wsse10Encrypt-client.jar -->
<jar destfile="${tests.output.dir}/test-libs/jbossws-interop-wsse10Encrypt-client.jar">
@@ -141,6 +144,9 @@
<fileset dir="${tests.output.dir}/test-resources/interop/wsse/">
<include name="*.*"/>
</fileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jbossws-interop-wsse10Sign-client.jar -->
<jar destfile="${tests.output.dir}/test-libs/jbossws-interop-wsse10Sign-client.jar">
@@ -193,6 +199,9 @@
<fileset dir="${tests.output.dir}/test-resources/interop/nov2007/wsse/">
<include name="*.*"/>
</fileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jbossws-interop-nov2007-wsseEncrypt.jar -->
<jar destfile="${tests.output.dir}/test-libs/jbossws-interop-nov2007-wsseEncrypt-client.jar">
@@ -222,6 +231,9 @@
<fileset dir="${tests.output.dir}/test-resources/interop/nov2007/wsse/">
<include name="*.*"/>
</fileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jbossws-interop-nov2007-wsseEncrypt3DES.jar -->
<jar destfile="${tests.output.dir}/test-libs/jbossws-interop-nov2007-wsseEncrypt3DES-client.jar">
@@ -245,6 +257,9 @@
<fileset dir="${tests.output.dir}/test-resources/interop/nov2007/wsse/">
<include name="*.*"/>
</fileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jbossws-interop-nov2007-wsseUsernameTokenHTTPS-client.jar -->
<jar destfile="${tests.output.dir}/test-libs/jbossws-interop-nov2007-wsseUsernameTokenHTTPS-client.jar">
Modified: stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2011-04-14 16:28:19 UTC (rev 14103)
@@ -86,6 +86,9 @@
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/fastinfoset/FastInfosetEndpoint.class" />
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-handlerlifecycle -->
@@ -122,12 +125,16 @@
<war warfile="${tests.output.dir}/test-libs/jaxws-jaxbintros.war" webxml="${tests.output.dir}/test-resources/jaxws/jaxbintros/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/jaxbintros/**/*.class" />
+ <include name="org/jboss/test/helper/DOMWriter.class" />
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/jaxbintros/WEB-INF">
<include name="*.xml" />
<include name="**/*.wsdl" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-jbws771 -->
@@ -144,6 +151,9 @@
<include name="org/jboss/test/ws/jaxws/jbws871/RpcArrayEndpoint.class" />
<include name="org/jboss/test/ws/jaxws/jbws871/RpcArrayEndpointImpl.class" />
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<jar destfile="${tests.output.dir}/test-libs/jaxws-jbws871-rpc-client.jar">
<fileset dir="${tests.output.dir}/test-classes">
@@ -210,6 +220,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws1814/WEB-INF">
<include name="*" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-jbws1850 -->
@@ -303,6 +316,9 @@
<metainf dir="${tests.output.dir}/test-resources/jaxws/jbws2014/">
<include name="wsse.*" />
</metainf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</jar>
<jar destfile="${tests.output.dir}/test-libs/jaxws-jbws2014-encrypt.jar">
<fileset dir="${tests.output.dir}/test-classes">
@@ -315,6 +331,9 @@
<metainf dir="${tests.output.dir}/test-resources/jaxws/jbws2014/">
<include name="wsse.*" />
</metainf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</jar>
<!-- jaxws-jbws2116-->
@@ -433,6 +452,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2259/WEB-INF">
<include name="jaxws-endpoint-config.xml" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-jbws2285 -->
@@ -441,10 +463,14 @@
<include name="org/jboss/test/ws/jaxws/jbws2285/*.class" />
<exclude name="org/jboss/test/ws/jaxws/jbws2285/JBWS2285TestCase.class" />
<include name="org/jboss/test/ws/jaxws/jbws2285/server-handlers.xml" />
+ <include name="org/jboss/test/helper/DOMWriter.class" />
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2285/WEB-INF">
<include name="jboss-web.xml" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-jbws2319 -->
@@ -453,10 +479,14 @@
<include name="org/jboss/test/ws/jaxws/jbws2319/*.class" />
<exclude name="org/jboss/test/ws/jaxws/jbws2319/JBWS2285TestCase.class" />
<include name="org/jboss/test/ws/jaxws/jbws2319/server-handlers.xml" />
+ <include name="org/jboss/test/helper/DOMWriter.class" />
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2319/WEB-INF">
<include name="jboss-web.xml" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-jbws2437 -->
@@ -477,6 +507,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2526/WEB-INF">
<include name="wsdl/**" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-jbws2565 -->
@@ -524,6 +557,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2698/WEB-INF">
<include name="jboss-web.xml" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-jbws2706 -->
@@ -581,6 +617,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws2949/WEB-INF">
<include name="jboss-web.xml" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-jbws2969 -->
@@ -870,6 +909,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/wseventing/WEB-INF">
<include name="wsdl/**" />
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-wsrm -->
@@ -885,6 +927,9 @@
</webinf>
<zipfileset dir="${tests.output.dir}/test-resources/jaxws/wsrm/WEB-INF/unsecure/wsdl" prefix="WEB-INF/wsdl" />
<zipfileset file="${tests.output.dir}/test-resources/jaxws/wsrm/WEB-INF/unsecure/standard-jaxws-endpoint-config.xml" prefix="META-INF" />
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<war warfile="${tests.output.dir}/test-libs/jaxws-secured-wsrm.war" webxml="${tests.output.dir}/test-resources/jaxws/wsrm/WEB-INF/secure/web.xml">
@@ -906,6 +951,9 @@
</webinf>
<zipfileset dir="${tests.output.dir}/test-resources/jaxws/wsrm/WEB-INF/secure/wsdl" prefix="WEB-INF/wsdl" />
<zipfileset file="${tests.output.dir}/test-resources/jaxws/wsrm/WEB-INF/secure/standard-jaxws-endpoint-config.xml" prefix="META-INF" />
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<jar jarfile="${tests.output.dir}/test-libs/jaxws-wsrm-client.jar">
Modified: stack/native/trunk/modules/testsuite/native-tests/scripts/build-samples-jaxws.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/scripts/build-samples-jaxws.xml 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/testsuite/native-tests/scripts/build-samples-jaxws.xml 2011-04-14 16:28:19 UTC (rev 14103)
@@ -280,6 +280,9 @@
<include name="wsdl/ws-eventing.xsd"/>
<include name="wsdl/ws-addr.xsd"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<jar destfile="${tests.output.dir}/test-libs/jaxws-samples-wseventing-sink.jar">
<fileset dir="${tests.output.dir}/test-classes">
@@ -295,6 +298,9 @@
</classes>
<zipfileset dir="${tests.output.dir}/test-resources/jaxws/samples/wsrm/WEB-INF/wsdl" prefix="WEB-INF/wsdl"/>
<zipfileset file="${tests.output.dir}/test-resources/jaxws/samples/wsrm/WEB-INF/wsrm-jaxws-endpoint-config.xml" prefix="META-INF"/>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<jar jarfile="${tests.output.dir}/test-libs/jaxws-samples-wsrm-client.jar">
@@ -321,6 +327,9 @@
<include name="wsse.keystore"/>
<include name="wsse.truststore"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssecurity-sign -->
@@ -340,6 +349,9 @@
<include name="wsse.keystore"/>
<include name="wsse.truststore"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssecurity-sign-fault -->
@@ -359,6 +371,9 @@
<include name="wsse.keystore"/>
<include name="wsse.truststore"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssecurity-sign-encrypt-fault -->
@@ -378,6 +393,9 @@
<include name="wsse.keystore"/>
<include name="wsse.truststore"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssecurity-username -->
@@ -391,6 +409,9 @@
<include name="jboss-web.xml"/>
<include name="jboss-wsse-server.xml"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssecurityAnnotatedpolicy-encrypt -->
@@ -409,6 +430,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wssecurityAnnotatedpolicy/WEB-INF">
<include name="Policy.xml"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssecuritypolicy-encrypt -->
@@ -427,6 +451,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wssecuritypolicy/WEB-INF">
<include name="wsdl/**"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.jboss.ws.native.jbossws-native-core"/>
+ </manifest>
</war>
<!-- Please add alphabetically -->
Deleted: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java
===================================================================
--- stack/native/branches/asoldano/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java 2011-04-11 22:38:29 UTC (rev 14057)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -1,671 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache(a)apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.jboss.test.helper;
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Traverse a DOM tree in order to print a document that is parsed.
- *
- * @author Andy Clark, IBM
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:mvecera@redhat.com">Martin Vecera</a>
- * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
- */
-@SuppressWarnings("unchecked")
-public class DOMWriter
-{
- private static final Pattern PATTERN = Pattern.compile("[&<>'\"\r\n]");
- // Print writer
- private PrintWriter out;
- // True, if canonical output
- private boolean canonical;
- // True, if pretty printing should be used
- private boolean prettyprint;
- // True, if the XML declaration should be written
- private boolean writeXMLDeclaration;
- // True, if whitespace should be ignored
- private boolean ignoreWhitespace;
- // Explicit character set encoding
- private String charsetName;
- // indent for the pretty printer
- private int prettyIndent;
- // True, if the XML declaration has been written
- private boolean wroteXMLDeclaration;
- // The node that started the write
- private Node rootNode;
- // True if we want namespace completion
- private boolean completeNamespaces = true;
- // The current default namespace
- private String currentDefaultNamespace;
-
- public DOMWriter(Writer w)
- {
- this.out = new PrintWriter(w);
- }
-
- public DOMWriter(Writer w, String charsetName)
- {
- this.out = new PrintWriter(w);
- this.charsetName = charsetName;
- this.writeXMLDeclaration = true;
- }
-
- public DOMWriter(OutputStream stream)
- {
- try
- {
- this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
- }
- catch (UnsupportedEncodingException e)
- {
- // ignore, UTF-8 should be available
- }
- }
-
- public DOMWriter(OutputStream stream, String charsetName)
- {
- try
- {
- this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
- this.charsetName = charsetName;
- this.writeXMLDeclaration = true;
- }
- catch (UnsupportedEncodingException e)
- {
- throw new IllegalArgumentException("Unsupported encoding: " + charsetName);
- }
- }
-
- /**
- * Print a node with explicit prettyprinting.
- * The defaults for all other DOMWriter properties apply.
- *
- */
- public static String printNode(Node node, boolean prettyprint)
- {
- StringWriter strw = new StringWriter();
- new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
- return strw.toString();
- }
-
- public boolean isCanonical()
- {
- return canonical;
- }
-
- /**
- * Set wheter entities should appear in their canonical form.
- * The default is false.
- */
- public DOMWriter setCanonical(boolean canonical)
- {
- this.canonical = canonical;
- return this;
- }
-
- public boolean isIgnoreWhitespace()
- {
- return ignoreWhitespace;
- }
-
- /**
- * Set whether whitespace should be ignored.
- * The default is false.
- */
- public DOMWriter setIgnoreWhitespace(boolean ignoreWhitespace)
- {
- this.ignoreWhitespace = ignoreWhitespace;
- return this;
- }
-
- /**
- * Set wheter subelements should have their namespaces completed.
- * Setting this to false may lead to invalid XML fragments.
- * The default is true.
- */
- public DOMWriter setCompleteNamespaces(boolean complete)
- {
- this.completeNamespaces = complete;
- return this;
- }
-
- public boolean isPrettyprint()
- {
- return prettyprint;
- }
-
- /**
- * Set wheter element should be indented.
- * The default is false.
- */
- public DOMWriter setPrettyprint(boolean prettyprint)
- {
- this.prettyprint = prettyprint;
- return this;
- }
-
- public boolean isWriteXMLDeclaration()
- {
- return writeXMLDeclaration;
- }
-
- /**
- * Set wheter the XML declaration should be written.
- * The default is false.
- */
- public DOMWriter setWriteXMLDeclaration(boolean flag)
- {
- this.writeXMLDeclaration = flag;
- return this;
- }
-
- public void print(Node node)
- {
- if (prettyprint && ignoreWhitespace)
- throw new IllegalStateException("Cannot pretty print and ignore whitespace");
-
- rootNode = node;
- printInternal(node, false);
- }
-
- private void printInternal(Node node, boolean indentEndMarker)
- {
- // is there anything to do?
- if (node == null)
- {
- return;
- }
-
- // JBAS-2117 - Don't skip the DOCUMENT_NODE
- // if (node instanceof Document) node = ((Document)node).getDocumentElement();
-
- if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false)
- {
- out.print("<?xml version='1.0'");
- if (charsetName != null)
- out.print(" encoding='" + charsetName + "'");
-
- out.print("?>");
- if (prettyprint)
- out.println();
-
- wroteXMLDeclaration = true;
- }
-
- int type = node.getNodeType();
- boolean hasChildNodes = node.getChildNodes().getLength() > 0;
-
- String nodeName = node.getNodeName();
- switch (type)
- {
- // print document
- case Node.DOCUMENT_NODE:
- {
- NodeList children = node.getChildNodes();
- int len = children.getLength();
- for (int iChild = 0; iChild < len; iChild++)
- {
- printInternal(children.item(iChild), false);
- }
- out.flush();
- break;
- }
-
- // print element with attributes
- case Node.ELEMENT_NODE:
- {
- Element element = (Element)node;
- if (prettyprint)
- {
- for (int i = 0; i < prettyIndent; i++)
- {
- out.print(' ');
- }
- prettyIndent++;
- }
-
- out.print('<');
- out.print(nodeName);
-
- Map nsMap = new HashMap();
- String elPrefix = node.getPrefix();
- String elNamespaceURI = node.getNamespaceURI();
- if (elPrefix != null)
- {
- String nsURI = getNamespaceURI(elPrefix, element, rootNode);
- nsMap.put(elPrefix, nsURI);
- }
-
- Attr attrs[] = sortAttributes(node.getAttributes());
- for (int i = 0; i < attrs.length; i++)
- {
- Attr attr = attrs[i];
- String atPrefix = attr.getPrefix();
- String atName = attr.getNodeName();
- String atValue = normalize(attr.getNodeValue(), canonical);
-
- if (atName.equals("xmlns"))
- currentDefaultNamespace = atValue;
-
- if (atPrefix != null && !atPrefix.equals("xmlns") && !atPrefix.equals("xml"))
- {
- String nsURI = getNamespaceURI(atPrefix, element, rootNode);
- nsMap.put(atPrefix, nsURI);
- // xsi:type='ns1:SubType', xsi:type='xsd:string'
- if (atName.equals(atPrefix + ":type") && atValue.indexOf(":") > 0)
- {
- // xsi defined on the envelope
- if (nsURI == null)
- nsURI = getNamespaceURI(atPrefix, element, null);
-
- if ("http://www.w3.org/2001/XMLSchema-instance".equals(nsURI))
- {
- String typePrefix = atValue.substring(0, atValue.indexOf(":"));
- String typeURI = getNamespaceURI(typePrefix, element, rootNode);
- nsMap.put(typePrefix, typeURI);
- }
- }
- }
-
- out.print(" " + atName + "='" + atValue + "'");
- }
-
- // Add namespace declaration for prefixes
- // that are defined further up the tree
- if (completeNamespaces)
- {
- Iterator itPrefix = nsMap.keySet().iterator();
- while (itPrefix.hasNext())
- {
- String prefix = (String)itPrefix.next();
- String nsURI = (String)nsMap.get(prefix);
- if (nsURI == null)
- {
- nsURI = getNamespaceURI(prefix, element, null);
- out.print(" xmlns:" + prefix + "='" + nsURI + "'");
- }
- }
- }
-
- // The SAX ContentHandler will by default not add the namespace declaration
- // <Hello xmlns='http://somens'>World</Hello>
- if (elPrefix == null && elNamespaceURI != null)
- {
- String defaultNamespace = element.getAttribute("xmlns");
- if (defaultNamespace.length() == 0 && !elNamespaceURI.equals(currentDefaultNamespace))
- {
- out.print(" xmlns='" + elNamespaceURI + "'");
- currentDefaultNamespace = elNamespaceURI;
- }
- }
-
- if (hasChildNodes)
- {
- out.print('>');
- }
-
- // Find out if the end marker is indented
- indentEndMarker = isEndMarkerIndented(node);
-
- if (indentEndMarker)
- {
- out.print('\n');
- }
-
- NodeList childNodes = node.getChildNodes();
- int len = childNodes.getLength();
- for (int i = 0; i < len; i++)
- {
- Node childNode = childNodes.item(i);
- printInternal(childNode, false);
- }
- break;
- }
-
- // handle entity reference nodes
- case Node.ENTITY_REFERENCE_NODE:
- {
- if (canonical)
- {
- NodeList children = node.getChildNodes();
- if (children != null)
- {
- int len = children.getLength();
- for (int i = 0; i < len; i++)
- {
- printInternal(children.item(i), false);
- }
- }
- }
- else
- {
- out.print('&');
- out.print(nodeName);
- out.print(';');
- }
- break;
- }
-
- // print cdata sections
- case Node.CDATA_SECTION_NODE:
- {
- if (canonical)
- {
- out.print(normalize(node.getNodeValue(), canonical));
- }
- else
- {
- out.print("<![CDATA[");
- out.print(node.getNodeValue());
- out.print("]]>");
- }
- break;
- }
-
- // print text
- case Node.TEXT_NODE:
- {
- String text = normalize(node.getNodeValue(), canonical);
- if (text.trim().length() > 0)
- {
- out.print(text);
- }
- else if (prettyprint == false && ignoreWhitespace == false)
- {
- out.print(text);
- }
- break;
- }
-
- // print processing instruction
- case Node.PROCESSING_INSTRUCTION_NODE:
- {
- out.print("<?");
- out.print(nodeName);
- String data = node.getNodeValue();
- if (data != null && data.length() > 0)
- {
- out.print(' ');
- out.print(data);
- }
- out.print("?>");
- break;
- }
-
- // print comment
- case Node.COMMENT_NODE:
- {
- for (int i = 0; i < prettyIndent; i++)
- {
- out.print(' ');
- }
-
- out.print("<!--");
- String data = node.getNodeValue();
- if (data != null)
- {
- out.print(data);
- }
- out.print("-->");
-
- if (prettyprint)
- {
- out.print('\n');
- }
-
- break;
- }
- }
-
- if (type == Node.ELEMENT_NODE)
- {
- if (prettyprint)
- prettyIndent--;
-
- if (hasChildNodes == false)
- {
- out.print("/>");
- }
- else
- {
- if (indentEndMarker)
- {
- for (int i = 0; i < prettyIndent; i++)
- {
- out.print(' ');
- }
- }
-
- out.print("</");
- out.print(nodeName);
- out.print('>');
- }
-
- if (prettyIndent > 0)
- {
- out.print('\n');
- }
- }
- out.flush();
- }
-
- private String getNamespaceURI(String prefix, Element element, Node stopNode)
- {
- Node parent = element.getParentNode();
- String nsURI = element.getAttribute("xmlns:" + prefix);
- if (nsURI.length() == 0 && element != stopNode && parent instanceof Element)
- return getNamespaceURI(prefix, (Element)parent, stopNode);
-
- return (nsURI.length() > 0 ? nsURI : null);
- }
-
- private boolean isEndMarkerIndented(Node node)
- {
- if (prettyprint)
- {
- NodeList childNodes = node.getChildNodes();
- int len = childNodes.getLength();
- for (int i = 0; i < len; i++)
- {
- Node children = childNodes.item(i);
- if (children.getNodeType() == Node.ELEMENT_NODE)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- /** Returns a sorted list of attributes. */
- private Attr[] sortAttributes(NamedNodeMap attrs)
- {
-
- int len = (attrs != null) ? attrs.getLength() : 0;
- Attr array[] = new Attr[len];
- for (int i = 0; i < len; i++)
- {
- array[i] = (Attr)attrs.item(i);
- }
- for (int i = 0; i < len - 1; i++)
- {
- String name = array[i].getNodeName();
- int index = i;
- for (int j = i + 1; j < len; j++)
- {
- String curName = array[j].getNodeName();
- if (curName.compareTo(name) < 0)
- {
- name = curName;
- index = j;
- }
- }
- if (index != i)
- {
- Attr temp = array[i];
- array[i] = array[index];
- array[index] = temp;
- }
- }
- return (array);
- }
-
- /** Normalizes the given string. */
- public static String normalize(String strValue, boolean canonical)
- {
- Matcher m = PATTERN.matcher(strValue);
- if (m.find())
- {
- int pos = m.start(); // we can use previous match to skip some part at the string beginning
- int len = strValue.length(); // just a single call to length()
- char[] input = new char[len]; // this is to ommit calls to String.charAt()
- strValue.getChars(0, len, input, 0);
- StringBuilder sb = new StringBuilder(len * 3); // faster than StringBuffer, not thread safe
-
- int copyStart = 0;
-
- for (int i = pos; i < len; i++)
- {
- char ch = input[i];
- switch (ch)
- {
- case '<' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append("<");
- break;
- case '>' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append(">");
- break;
- case '"' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append(""");
- break;
- case '\'' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append("'");
- break;
- case '&' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append("&");
- break;
- case '\r' :
- case '\n' :
- if (canonical)
- {
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append("&#");
- sb.append(Integer.toString(ch));
- sb.append(';');
- break;
- }
-
- }
- }
- if (copyStart < len)
- {
- sb.append(input, copyStart, len - copyStart);
- }
-
- return sb.toString();
- }
- else
- {
- return strValue;
- }
- }
-}
Copied: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java (from rev 14057, stack/native/branches/asoldano/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java)
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/helper/DOMWriter.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -0,0 +1,671 @@
+/*
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.jboss.test.helper;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Traverse a DOM tree in order to print a document that is parsed.
+ *
+ * @author Andy Clark, IBM
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:mvecera@redhat.com">Martin Vecera</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
+ */
+@SuppressWarnings("unchecked")
+public class DOMWriter
+{
+ private static final Pattern PATTERN = Pattern.compile("[&<>'\"\r\n]");
+ // Print writer
+ private PrintWriter out;
+ // True, if canonical output
+ private boolean canonical;
+ // True, if pretty printing should be used
+ private boolean prettyprint;
+ // True, if the XML declaration should be written
+ private boolean writeXMLDeclaration;
+ // True, if whitespace should be ignored
+ private boolean ignoreWhitespace;
+ // Explicit character set encoding
+ private String charsetName;
+ // indent for the pretty printer
+ private int prettyIndent;
+ // True, if the XML declaration has been written
+ private boolean wroteXMLDeclaration;
+ // The node that started the write
+ private Node rootNode;
+ // True if we want namespace completion
+ private boolean completeNamespaces = true;
+ // The current default namespace
+ private String currentDefaultNamespace;
+
+ public DOMWriter(Writer w)
+ {
+ this.out = new PrintWriter(w);
+ }
+
+ public DOMWriter(Writer w, String charsetName)
+ {
+ this.out = new PrintWriter(w);
+ this.charsetName = charsetName;
+ this.writeXMLDeclaration = true;
+ }
+
+ public DOMWriter(OutputStream stream)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // ignore, UTF-8 should be available
+ }
+ }
+
+ public DOMWriter(OutputStream stream, String charsetName)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
+ this.charsetName = charsetName;
+ this.writeXMLDeclaration = true;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new IllegalArgumentException("Unsupported encoding: " + charsetName);
+ }
+ }
+
+ /**
+ * Print a node with explicit prettyprinting.
+ * The defaults for all other DOMWriter properties apply.
+ *
+ */
+ public static String printNode(Node node, boolean prettyprint)
+ {
+ StringWriter strw = new StringWriter();
+ new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
+ return strw.toString();
+ }
+
+ public boolean isCanonical()
+ {
+ return canonical;
+ }
+
+ /**
+ * Set wheter entities should appear in their canonical form.
+ * The default is false.
+ */
+ public DOMWriter setCanonical(boolean canonical)
+ {
+ this.canonical = canonical;
+ return this;
+ }
+
+ public boolean isIgnoreWhitespace()
+ {
+ return ignoreWhitespace;
+ }
+
+ /**
+ * Set whether whitespace should be ignored.
+ * The default is false.
+ */
+ public DOMWriter setIgnoreWhitespace(boolean ignoreWhitespace)
+ {
+ this.ignoreWhitespace = ignoreWhitespace;
+ return this;
+ }
+
+ /**
+ * Set wheter subelements should have their namespaces completed.
+ * Setting this to false may lead to invalid XML fragments.
+ * The default is true.
+ */
+ public DOMWriter setCompleteNamespaces(boolean complete)
+ {
+ this.completeNamespaces = complete;
+ return this;
+ }
+
+ public boolean isPrettyprint()
+ {
+ return prettyprint;
+ }
+
+ /**
+ * Set wheter element should be indented.
+ * The default is false.
+ */
+ public DOMWriter setPrettyprint(boolean prettyprint)
+ {
+ this.prettyprint = prettyprint;
+ return this;
+ }
+
+ public boolean isWriteXMLDeclaration()
+ {
+ return writeXMLDeclaration;
+ }
+
+ /**
+ * Set wheter the XML declaration should be written.
+ * The default is false.
+ */
+ public DOMWriter setWriteXMLDeclaration(boolean flag)
+ {
+ this.writeXMLDeclaration = flag;
+ return this;
+ }
+
+ public void print(Node node)
+ {
+ if (prettyprint && ignoreWhitespace)
+ throw new IllegalStateException("Cannot pretty print and ignore whitespace");
+
+ rootNode = node;
+ printInternal(node, false);
+ }
+
+ private void printInternal(Node node, boolean indentEndMarker)
+ {
+ // is there anything to do?
+ if (node == null)
+ {
+ return;
+ }
+
+ // JBAS-2117 - Don't skip the DOCUMENT_NODE
+ // if (node instanceof Document) node = ((Document)node).getDocumentElement();
+
+ if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false)
+ {
+ out.print("<?xml version='1.0'");
+ if (charsetName != null)
+ out.print(" encoding='" + charsetName + "'");
+
+ out.print("?>");
+ if (prettyprint)
+ out.println();
+
+ wroteXMLDeclaration = true;
+ }
+
+ int type = node.getNodeType();
+ boolean hasChildNodes = node.getChildNodes().getLength() > 0;
+
+ String nodeName = node.getNodeName();
+ switch (type)
+ {
+ // print document
+ case Node.DOCUMENT_NODE:
+ {
+ NodeList children = node.getChildNodes();
+ int len = children.getLength();
+ for (int iChild = 0; iChild < len; iChild++)
+ {
+ printInternal(children.item(iChild), false);
+ }
+ out.flush();
+ break;
+ }
+
+ // print element with attributes
+ case Node.ELEMENT_NODE:
+ {
+ Element element = (Element)node;
+ if (prettyprint)
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+ prettyIndent++;
+ }
+
+ out.print('<');
+ out.print(nodeName);
+
+ Map nsMap = new HashMap();
+ String elPrefix = node.getPrefix();
+ String elNamespaceURI = node.getNamespaceURI();
+ if (elPrefix != null)
+ {
+ String nsURI = getNamespaceURI(elPrefix, element, rootNode);
+ nsMap.put(elPrefix, nsURI);
+ }
+
+ Attr attrs[] = sortAttributes(node.getAttributes());
+ for (int i = 0; i < attrs.length; i++)
+ {
+ Attr attr = attrs[i];
+ String atPrefix = attr.getPrefix();
+ String atName = attr.getNodeName();
+ String atValue = normalize(attr.getNodeValue(), canonical);
+
+ if (atName.equals("xmlns"))
+ currentDefaultNamespace = atValue;
+
+ if (atPrefix != null && !atPrefix.equals("xmlns") && !atPrefix.equals("xml"))
+ {
+ String nsURI = getNamespaceURI(atPrefix, element, rootNode);
+ nsMap.put(atPrefix, nsURI);
+ // xsi:type='ns1:SubType', xsi:type='xsd:string'
+ if (atName.equals(atPrefix + ":type") && atValue.indexOf(":") > 0)
+ {
+ // xsi defined on the envelope
+ if (nsURI == null)
+ nsURI = getNamespaceURI(atPrefix, element, null);
+
+ if ("http://www.w3.org/2001/XMLSchema-instance".equals(nsURI))
+ {
+ String typePrefix = atValue.substring(0, atValue.indexOf(":"));
+ String typeURI = getNamespaceURI(typePrefix, element, rootNode);
+ nsMap.put(typePrefix, typeURI);
+ }
+ }
+ }
+
+ out.print(" " + atName + "='" + atValue + "'");
+ }
+
+ // Add namespace declaration for prefixes
+ // that are defined further up the tree
+ if (completeNamespaces)
+ {
+ Iterator itPrefix = nsMap.keySet().iterator();
+ while (itPrefix.hasNext())
+ {
+ String prefix = (String)itPrefix.next();
+ String nsURI = (String)nsMap.get(prefix);
+ if (nsURI == null)
+ {
+ nsURI = getNamespaceURI(prefix, element, null);
+ out.print(" xmlns:" + prefix + "='" + nsURI + "'");
+ }
+ }
+ }
+
+ // The SAX ContentHandler will by default not add the namespace declaration
+ // <Hello xmlns='http://somens'>World</Hello>
+ if (elPrefix == null && elNamespaceURI != null)
+ {
+ String defaultNamespace = element.getAttribute("xmlns");
+ if (defaultNamespace.length() == 0 && !elNamespaceURI.equals(currentDefaultNamespace))
+ {
+ out.print(" xmlns='" + elNamespaceURI + "'");
+ currentDefaultNamespace = elNamespaceURI;
+ }
+ }
+
+ if (hasChildNodes)
+ {
+ out.print('>');
+ }
+
+ // Find out if the end marker is indented
+ indentEndMarker = isEndMarkerIndented(node);
+
+ if (indentEndMarker)
+ {
+ out.print('\n');
+ }
+
+ NodeList childNodes = node.getChildNodes();
+ int len = childNodes.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node childNode = childNodes.item(i);
+ printInternal(childNode, false);
+ }
+ break;
+ }
+
+ // handle entity reference nodes
+ case Node.ENTITY_REFERENCE_NODE:
+ {
+ if (canonical)
+ {
+ NodeList children = node.getChildNodes();
+ if (children != null)
+ {
+ int len = children.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ printInternal(children.item(i), false);
+ }
+ }
+ }
+ else
+ {
+ out.print('&');
+ out.print(nodeName);
+ out.print(';');
+ }
+ break;
+ }
+
+ // print cdata sections
+ case Node.CDATA_SECTION_NODE:
+ {
+ if (canonical)
+ {
+ out.print(normalize(node.getNodeValue(), canonical));
+ }
+ else
+ {
+ out.print("<![CDATA[");
+ out.print(node.getNodeValue());
+ out.print("]]>");
+ }
+ break;
+ }
+
+ // print text
+ case Node.TEXT_NODE:
+ {
+ String text = normalize(node.getNodeValue(), canonical);
+ if (text.trim().length() > 0)
+ {
+ out.print(text);
+ }
+ else if (prettyprint == false && ignoreWhitespace == false)
+ {
+ out.print(text);
+ }
+ break;
+ }
+
+ // print processing instruction
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ {
+ out.print("<?");
+ out.print(nodeName);
+ String data = node.getNodeValue();
+ if (data != null && data.length() > 0)
+ {
+ out.print(' ');
+ out.print(data);
+ }
+ out.print("?>");
+ break;
+ }
+
+ // print comment
+ case Node.COMMENT_NODE:
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+
+ out.print("<!--");
+ String data = node.getNodeValue();
+ if (data != null)
+ {
+ out.print(data);
+ }
+ out.print("-->");
+
+ if (prettyprint)
+ {
+ out.print('\n');
+ }
+
+ break;
+ }
+ }
+
+ if (type == Node.ELEMENT_NODE)
+ {
+ if (prettyprint)
+ prettyIndent--;
+
+ if (hasChildNodes == false)
+ {
+ out.print("/>");
+ }
+ else
+ {
+ if (indentEndMarker)
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+ }
+
+ out.print("</");
+ out.print(nodeName);
+ out.print('>');
+ }
+
+ if (prettyIndent > 0)
+ {
+ out.print('\n');
+ }
+ }
+ out.flush();
+ }
+
+ private String getNamespaceURI(String prefix, Element element, Node stopNode)
+ {
+ Node parent = element.getParentNode();
+ String nsURI = element.getAttribute("xmlns:" + prefix);
+ if (nsURI.length() == 0 && element != stopNode && parent instanceof Element)
+ return getNamespaceURI(prefix, (Element)parent, stopNode);
+
+ return (nsURI.length() > 0 ? nsURI : null);
+ }
+
+ private boolean isEndMarkerIndented(Node node)
+ {
+ if (prettyprint)
+ {
+ NodeList childNodes = node.getChildNodes();
+ int len = childNodes.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node children = childNodes.item(i);
+ if (children.getNodeType() == Node.ELEMENT_NODE)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /** Returns a sorted list of attributes. */
+ private Attr[] sortAttributes(NamedNodeMap attrs)
+ {
+
+ int len = (attrs != null) ? attrs.getLength() : 0;
+ Attr array[] = new Attr[len];
+ for (int i = 0; i < len; i++)
+ {
+ array[i] = (Attr)attrs.item(i);
+ }
+ for (int i = 0; i < len - 1; i++)
+ {
+ String name = array[i].getNodeName();
+ int index = i;
+ for (int j = i + 1; j < len; j++)
+ {
+ String curName = array[j].getNodeName();
+ if (curName.compareTo(name) < 0)
+ {
+ name = curName;
+ index = j;
+ }
+ }
+ if (index != i)
+ {
+ Attr temp = array[i];
+ array[i] = array[index];
+ array[index] = temp;
+ }
+ }
+ return (array);
+ }
+
+ /** Normalizes the given string. */
+ public static String normalize(String strValue, boolean canonical)
+ {
+ Matcher m = PATTERN.matcher(strValue);
+ if (m.find())
+ {
+ int pos = m.start(); // we can use previous match to skip some part at the string beginning
+ int len = strValue.length(); // just a single call to length()
+ char[] input = new char[len]; // this is to ommit calls to String.charAt()
+ strValue.getChars(0, len, input, 0);
+ StringBuilder sb = new StringBuilder(len * 3); // faster than StringBuffer, not thread safe
+
+ int copyStart = 0;
+
+ for (int i = pos; i < len; i++)
+ {
+ char ch = input[i];
+ switch (ch)
+ {
+ case '<' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("<");
+ break;
+ case '>' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append(">");
+ break;
+ case '"' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append(""");
+ break;
+ case '\'' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("'");
+ break;
+ case '&' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("&");
+ break;
+ case '\r' :
+ case '\n' :
+ if (canonical)
+ {
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("&#");
+ sb.append(Integer.toString(ch));
+ sb.append(';');
+ break;
+ }
+
+ }
+ }
+ if (copyStart < len)
+ {
+ sb.append(input, copyStart, len - copyStart);
+ }
+
+ return sb.toString();
+ }
+ else
+ {
+ return strValue;
+ }
+ }
+}
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/ProviderBeanJAXB.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -22,8 +22,8 @@
package org.jboss.test.ws.jaxws.jaxbintros;
import org.jboss.logging.Logger;
+import org.jboss.test.helper.DOMWriter;
import org.jboss.ws.core.jaxws.JAXBContextFactory;
-import org.jboss.wsf.common.DOMWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1909/TestEndpointImpl.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1909/TestEndpointImpl.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1909/TestEndpointImpl.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -31,19 +31,22 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.management.ObjectName;
+import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.common.ObjectNameFactory;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.RequestHandler;
import org.jboss.wsf.spi.management.EndpointRegistry;
import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
@WebService(serviceName = "TestEndpointService", name = "TestEndpoint", targetNamespace = "http://org.jboss.ws/jbws1909")
@@ -66,29 +69,50 @@
log.info(key + "=" + msgContext.get(key));
}
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- EndpointRegistry registry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
+ ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ EndpointRegistry registry = spiProvider.getSPI(EndpointRegistryFactory.class, cl).getEndpointRegistry();
- ObjectName oname = ObjectNameFactory.create("jboss.ws:context=jaxws-jbws1909,endpoint=TestEndpointImpl");
- Endpoint endpoint = registry.getEndpoint(oname);
- RequestHandler reqHandler = endpoint.getRequestHandler();
-
try
{
+ ObjectName oname = new ObjectName("jboss.ws:context=jaxws-jbws1909,endpoint=TestEndpointImpl");
+ Endpoint endpoint = registry.getEndpoint(oname);
+ RequestHandler reqHandler = endpoint.getRequestHandler();
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
reqHandler.handleWSDLRequest(endpoint, baos, null); // The context is null
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- Element root = DOMUtils.parse(bais);
+ Element root = DOMUtils.parse(bais, getDocumentBuilder());
Element serviceEl = DOMUtils.getFirstChildElement(root, new QName("http://schemas.xmlsoap.org/wsdl/", "service"));
String serviceName = DOMUtils.getAttributeValue(serviceEl, "name");
input += "|" + serviceName;
}
- catch (IOException ex)
+ catch (Exception ex)
{
throw new RuntimeException(ex);
}
return input;
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
+
}
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2285/LogicalHandler.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -29,8 +29,8 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.jboss.logging.Logger;
+import org.jboss.test.helper.DOMWriter;
import org.jboss.ws.WSException;
-import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.common.handler.GenericLogicalHandler;
/**
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2319/SOAPHandler.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2319/SOAPHandler.java 2011-04-14 16:08:22 UTC (rev 14102)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2319/SOAPHandler.java 2011-04-14 16:28:19 UTC (rev 14103)
@@ -29,8 +29,8 @@
import javax.xml.ws.handler.soap.SOAPMessageContext;
import org.jboss.logging.Logger;
+import org.jboss.test.helper.DOMWriter;
import org.jboss.ws.WSException;
-import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.common.handler.GenericSOAPHandler;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
13 years
JBossWS SVN: r14102 - in stack/native/trunk: modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl and 9 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 12:08:22 -0400 (Thu, 14 Apr 2011)
New Revision: 14102
Removed:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SecurityActions.java
stack/native/trunk/modules/resources/src/main/resources/modules/com/sun/tools/
stack/native/trunk/modules/resources/src/main/resources/modules/com/sun/xml/stream/
stack/native/trunk/modules/resources/src/main/resources/modules/com/sun/xml/ws/
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/
stack/native/trunk/modules/resources/src/main/resources/modules/org/jvnet/
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/native/jbossws-native-core/main/module.xml
stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/scripts/ScriptTestCase.java
stack/native/trunk/pom.xml
Log:
Rollback Richard's changes that does not work with the current AS7 upstream master; already moved to ropalka branch
svn merge -r 14089:14088 https://svn.jboss.org/repos/jbossws/stack/native/trunk .
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.java 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/JBossWSProviderImpl.java 2011-04-14 16:08:22 UTC (rev 14102)
@@ -130,20 +130,14 @@
@Override
public void provide(String endpointClass)
{
- final ClassLoader origLoader = SecurityActions.getContextClassLoader();
try
{
- SecurityActions.setContextClassLoader(loader);
provide(loader.loadClass(endpointClass));
}
catch (ClassNotFoundException e)
{
throw new WSException("Class not found: " + endpointClass);
}
- finally
- {
- SecurityActions.setContextClassLoader(origLoader);
- }
}
@Override
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SecurityActions.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SecurityActions.java 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SecurityActions.java 2011-04-14 16:08:22 UTC (rev 14102)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.ws.tools.jaxws.impl;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * TCCL utility methods.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- */
-final class SecurityActions
-{
-
- private SecurityActions()
- {
- // forbidden instantiation
- }
-
- /**
- * Get context classloader.
- *
- * @return the current context classloader
- */
- static ClassLoader getContextClassLoader()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return Thread.currentThread().getContextClassLoader();
- }
- else
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
- }
-
- /**
- * Set context classloader.
- *
- * @param classLoader the classloader
- */
- static void setContextClassLoader(final ClassLoader classLoader)
- {
- if (System.getSecurityManager() == null)
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- }
- else
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- Thread.currentThread().setContextClassLoader(classLoader);
- return null;
- }
- });
- }
- }
-
-
-}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2011-04-14 16:08:22 UTC (rev 14102)
@@ -197,7 +197,6 @@
if (stream != null)
{
args.add("-verbose");
- args.add("-Xdebug");
}
else
{
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml 2011-04-14 16:08:22 UTC (rev 14102)
@@ -28,23 +28,13 @@
</resources>
<dependencies>
- <module name="javax.api"/>
- <module name="javax.jws.api"/>
<module name="javax.wsdl4j.api" export="true"/>
- <module name="javax.xml.ws.api"/>
<module name="com.sun.xml.bind" services="export" export="true"/>
- <module name="com.sun.tools.javac"/>
<module name="org.jboss.ws.api" export="true"/>
<module name="org.jboss.ws.spi" export="true"/>
<module name="org.jboss.ws.common" export="true"/>
<module name="org.jboss.ws.native.jbossws-native-factories" services="export" export="true"/>
- <module name="org.jboss.ws.native.jbossws-native-core" services="export" export="true">
- <imports>
- <include path="META-INF"/>
- <include path="dtd"/>
- <include path="schema"/>
- </imports>
- </module>
+ <module name="org.jboss.ws.native.jbossws-native-core" services="export" export="true"/>
<module name="org.apache.xalan" services="export" export="true"/>
<module name="org.apache.xerces" services="export" export="true"/>
<module name="org.jboss.as.webservices" services="export" export="true"/>
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml 2011-04-14 16:08:22 UTC (rev 14102)
@@ -29,7 +29,6 @@
</resources>
<dependencies>
- <module name="gnu.getopt"/>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.ejb.api"/>
@@ -38,12 +37,10 @@
<module name="javax.wsdl4j.api" />
<module name="javax.xml.ws.api"/>
<module name="org.jboss.jaxbintros"/>
- <module name="org.jboss.modules"/>
<module name="org.jboss.ws.api"/>
<module name="org.jboss.ws.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.common-core"/>
- <module name="org.apache.log4j"/>
<module name="org.apache.xerces" services="import"/>
</dependencies>
</module>
Modified: stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/native/jbossws-native-core/main/module.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/native/jbossws-native-core/main/module.xml 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/native/jbossws-native-core/main/module.xml 2011-04-14 16:08:22 UTC (rev 14102)
@@ -29,7 +29,6 @@
</resources>
<dependencies>
- <module name="com.sun.tools.ws" services="import"/>
<module name="com.sun.xml.bind" services="import"/>
<module name="com.sun.xml.fastinfoset"/>
<module name="javax.api" />
Modified: stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2011-04-14 16:08:22 UTC (rev 14102)
@@ -329,36 +329,11 @@
<include name="**/xmlsec.jar"/>
</fileset>
</copy>
- <copy todir="@{targetdir}/com/sun/tools/ws/main" flatten="false" overwrite="true">
- <fileset dir="@{thirdpartydir}/lib">
- <include name="**/jaxws-tools.jar"/>
- </fileset>
- </copy>
- <copy todir="@{targetdir}/com/sun/xml/stream/buffer/main" flatten="false" overwrite="true">
- <fileset dir="@{thirdpartydir}/lib">
- <include name="**/streambuffer.jar"/>
- </fileset>
- </copy>
- <copy todir="@{targetdir}/com/sun/xml/ws/main" flatten="false" overwrite="true">
- <fileset dir="@{thirdpartydir}/lib">
- <include name="**/jaxws-rt.jar"/>
- </fileset>
- </copy>
- <copy todir="@{targetdir}/com/sun/xml/ws/policy/main" flatten="false" overwrite="true">
- <fileset dir="@{thirdpartydir}/lib">
- <include name="**/policy.jar"/>
- </fileset>
- </copy>
<copy todir="@{targetdir}/com/sun/xml/fastinfoset/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
<include name="**/FastInfoset.jar"/>
</fileset>
</copy>
- <copy todir="@{targetdir}/org/jvnet/staxex/main" flatten="false" overwrite="true">
- <fileset dir="@{thirdpartydir}/lib">
- <include name="**/stax-ex.jar"/>
- </fileset>
- </copy>
<copy todir="@{targetdir}/org/codehaus/jettison/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
<include name="**/jettison.jar"/>
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/scripts/ScriptTestCase.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/scripts/ScriptTestCase.java 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/scripts/ScriptTestCase.java 2011-04-14 16:08:22 UTC (rev 14102)
@@ -47,8 +47,6 @@
public void testWSToolsFromCommandLine() throws Exception
{
- if (!isTargetJBoss6()) return; // wstools.sh(.bat) not available since AS7
-
// use absolute path for the output to be re-usable
File dest = createResourceFile("wstools" + FS + "java");
dest.mkdirs();
Modified: stack/native/trunk/pom.xml
===================================================================
--- stack/native/trunk/pom.xml 2011-04-14 16:02:35 UTC (rev 14101)
+++ stack/native/trunk/pom.xml 2011-04-14 16:08:22 UTC (rev 14102)
@@ -527,18 +527,6 @@
</profile>
<!--
- Name: jboss700
- Descr: JBoss-7.0.0 specific options
- -->
- <profile>
- <id>jboss700</id>
- <properties>
- <jbossws.integration.target>jboss700</jbossws.integration.target>
- <jboss.home>${jboss700.home}</jboss.home>
- </properties>
- </profile>
-
- <!--
Name: smoketest
Descr: Executes the smoke tests
-->
13 years
JBossWS SVN: r14101 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 12:02:35 -0400 (Thu, 14 Apr 2011)
New Revision: 14101
Added:
stack/native/branches/ropalka/
Log:
Branching from trunk to apply wsconsume/wsprovide AS7 tooling changes
13 years
JBossWS SVN: r14100 - in stack/cxf/branches/ropalka: modules/resources/src/main/resources/modules/org/apache/cxf/main and 9 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 11:52:34 -0400 (Thu, 14 Apr 2011)
New Revision: 14100
Added:
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml
Removed:
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml
Modified:
stack/cxf/branches/ropalka/
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/apache/cxf/main/module.xml
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml
stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/jaxws-client/main/module.xml
Log:
svn merge -r 14089:14090 https://svn.jboss.org/repos/jbossws/stack/cxf/trunk .
Property changes on: stack/cxf/branches/ropalka
___________________________________________________________________
Added: svn:mergeinfo
+ /stack/cxf/trunk:14090
Modified: stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/apache/cxf/main/module.xml
===================================================================
--- stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/apache/cxf/main/module.xml 2011-04-14 15:45:26 UTC (rev 14099)
+++ stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/apache/cxf/main/module.xml 2011-04-14 15:52:34 UTC (rev 14100)
@@ -41,6 +41,7 @@
<module name="javax.xml.stream.api" />
<module name="javax.xml.ws.api" />
<module name="org.apache.neethi" />
+ <module name="org.apache.velocity" />
<module name="org.apache.ws.commons.xmlschema" />
<module name="org.apache.ws.security" />
<module name="org.apache.santuario.xmlsec" />
Modified: stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml
===================================================================
--- stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml 2011-04-14 15:45:26 UTC (rev 14099)
+++ stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/as/webservices/server/integration/main/module.xml 2011-04-14 15:52:34 UTC (rev 14100)
@@ -28,7 +28,10 @@
</resources>
<dependencies>
+ <module name="javax.api" export="true"/>
+ <module name="javax.jws.api" export="true"/>
<module name="javax.wsdl4j.api" export="true"/>
+ <module name="javax.xml.ws.api" export="true"/>
<module name="com.sun.xml.bind" services="export" export="true"/>
<module name="org.jboss.ws.api" export="true"/>
<module name="org.jboss.ws.spi" export="true"/>
Modified: stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml
===================================================================
--- stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml 2011-04-14 15:45:26 UTC (rev 14099)
+++ stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/common/main/module.xml 2011-04-14 15:52:34 UTC (rev 14100)
@@ -29,6 +29,7 @@
</resources>
<dependencies>
+ <module name="gnu.getopt"/>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.ejb.api"/>
@@ -36,10 +37,12 @@
<module name="javax.servlet.api"/>
<module name="javax.wsdl4j.api" />
<module name="javax.xml.ws.api"/>
+ <module name="org.jboss.modules"/>
<module name="org.jboss.ws.api"/>
<module name="org.jboss.ws.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.common-core"/>
+ <module name="org.apache.log4j"/>
<module name="org.apache.xerces" services="import"/>
</dependencies>
Modified: stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/jaxws-client/main/module.xml
===================================================================
--- stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/jaxws-client/main/module.xml 2011-04-14 15:45:26 UTC (rev 14099)
+++ stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/jaxws-client/main/module.xml 2011-04-14 15:52:34 UTC (rev 14100)
@@ -49,6 +49,7 @@
<include path="META-INF/"/>
</imports>
</module>
+ <module name="org.apache.log4j" />
<module name="org.apache.neethi" />
<module name="org.jboss.logging" />
<module name="org.springframework.spring" optional="true" />
Deleted: stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml 2011-04-14 12:58:25 UTC (rev 14090)
+++ stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml 2011-04-14 15:52:34 UTC (rev 14100)
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
-<module xmlns="urn:jboss:module:1.0" name="org.jboss.ws.tools.wsconsume">
-
- <main-class name="org.jboss.wsf.spi.tools.cmd.WSConsume"/>
-
- <dependencies>
- <module name="org.jboss.ws.common"/>
- </dependencies>
-
-</module>
Copied: stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml (from rev 14090, stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml)
===================================================================
--- stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml (rev 0)
+++ stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsconsume/main/module.xml 2011-04-14 15:52:34 UTC (rev 14100)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<module xmlns="urn:jboss:module:1.0" name="org.jboss.ws.tools.wsconsume">
+
+ <main-class name="org.jboss.wsf.spi.tools.cmd.WSConsume"/>
+
+ <dependencies>
+ <module name="org.jboss.ws.common"/>
+ </dependencies>
+
+</module>
Deleted: stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml 2011-04-14 12:58:25 UTC (rev 14090)
+++ stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml 2011-04-14 15:52:34 UTC (rev 14100)
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- -->
-
-<module xmlns="urn:jboss:module:1.0" name="org.jboss.ws.tools.wsprovide">
-
- <main-class name="org.jboss.wsf.spi.tools.cmd.WSProvide"/>
-
- <dependencies>
- <module name="org.jboss.ws.common"/>
- </dependencies>
-
-</module>
Copied: stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml (from rev 14090, stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml)
===================================================================
--- stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml (rev 0)
+++ stack/cxf/branches/ropalka/modules/resources/src/main/resources/modules/org/jboss/ws/tools/wsprovide/main/module.xml 2011-04-14 15:52:34 UTC (rev 14100)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2011, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<module xmlns="urn:jboss:module:1.0" name="org.jboss.ws.tools.wsprovide">
+
+ <main-class name="org.jboss.wsf.spi.tools.cmd.WSProvide"/>
+
+ <dependencies>
+ <module name="org.jboss.ws.common"/>
+ </dependencies>
+
+</module>
13 years
JBossWS SVN: r14099 - stack/cxf/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 11:45:26 -0400 (Thu, 14 Apr 2011)
New Revision: 14099
Added:
stack/cxf/branches/ropalka/
Log:
Branching (-r 14089) from trunk to apply wsconsume/wsprovide AS7 tooling changes
13 years
JBossWS SVN: r14098 - in stack/cxf/trunk: modules/resources/src/main/resources/modules/org/jboss/ws/api/main and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 11:39:55 -0400 (Thu, 14 Apr 2011)
New Revision: 14098
Modified:
stack/cxf/trunk/
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/spi/main/module.xml
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFNonSpringServletExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ServletControllerExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
Log:
[JBWS-3224][JBWS-3265] Isolate deployment classloader from ws integration
Property changes on: stack/cxf/trunk
___________________________________________________________________
Added: svn:mergeinfo
+ /stack/cxf/branches/asoldano:14032-14050,14068
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/api/main/module.xml 2011-04-14 15:39:55 UTC (rev 14098)
@@ -30,6 +30,9 @@
<dependencies>
<module name="javax.api"/>
+ <module name="com.sun.xml.messaging.saaj" services="export" export="true"/>
+ <module name="javax.xml.ws.api"/>
<module name="org.jboss.logging"/>
+ <module name="org.jboss.modules"/>
</dependencies>
</module>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/spi/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/spi/main/module.xml 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/org/jboss/ws/spi/main/module.xml 2011-04-14 15:39:55 UTC (rev 14098)
@@ -30,6 +30,7 @@
<dependencies>
<module name="javax.api"/>
+ <module name="javax.servlet.api"/>
<module name="javax.xml.stream.api"/>
<module name="javax.xml.ws.api"/>
<module name="org.jboss.logging"/>
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2011-04-14 15:39:55 UTC (rev 14098)
@@ -73,10 +73,14 @@
import org.apache.cxf.service.Service;
import org.apache.cxf.service.invoker.Invoker;
import org.apache.cxf.service.model.BindingOperationInfo;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.Invocation;
import org.jboss.wsf.spi.invocation.InvocationContext;
import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
/**
* An abstract CXF invoker
@@ -91,6 +95,7 @@
{
private static final Object[] NO_ARGS = new Object[]{};
private Object targetBean;
+ private WebServiceContextFactory contextFactory;
public void setTargetBean(Object targetBean)
{
@@ -327,5 +332,16 @@
ctx.put(key.getKey(), key.getValue(), Scope.HANDLER);
}
}
+
+ protected WebServiceContextFactory getWebServiceContextFactory()
+ {
+ if (contextFactory == null)
+ {
+ ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ contextFactory = spiProvider.getSPI(WebServiceContextFactory.class, cl);
+ }
+ return contextFactory;
+ }
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFNonSpringServletExt.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFNonSpringServletExt.java 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFNonSpringServletExt.java 2011-04-14 15:39:55 UTC (rev 14098)
@@ -21,7 +21,10 @@
*/
package org.jboss.wsf.stack.cxf;
+import java.io.IOException;
+
import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -33,6 +36,7 @@
import org.apache.cxf.transport.servlet.ServletController;
import org.apache.cxf.transport.servlet.ServletTransportFactory;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.ServletDelegate;
import org.jboss.wsf.stack.cxf.configuration.BusHolder;
import org.jboss.wsf.stack.cxf.transport.ServletHelper;
@@ -43,7 +47,7 @@
* @since 16-Jun-2010
*
*/
-public class CXFNonSpringServletExt extends CXFNonSpringServlet
+public class CXFNonSpringServletExt extends CXFNonSpringServlet implements ServletDelegate
{
protected Endpoint endpoint;
@@ -95,4 +99,46 @@
{
ServletHelper.callPreDestroy(endpoint);
}
+
+ @Override
+ public void doHead(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doHead(request, response);
+ }
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doGet(request, response);
+ }
+
+ @Override
+ public void doPost(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doPost(request, response);
+ }
+
+ @Override
+ public void doPut(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doPut(request, response);
+ }
+
+ @Override
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doDelete(request, response);
+ }
+
+ @Override
+ public void service(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.service(request, response);
+ }
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2011-04-14 15:39:55 UTC (rev 14098)
@@ -21,7 +21,10 @@
*/
package org.jboss.wsf.stack.cxf;
+import java.io.IOException;
+
import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -33,6 +36,7 @@
import org.apache.cxf.transport.servlet.ServletController;
import org.apache.cxf.transport.servlet.ServletTransportFactory;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.ServletDelegate;
import org.jboss.wsf.stack.cxf.configuration.BusHolder;
import org.jboss.wsf.stack.cxf.transport.ServletHelper;
@@ -44,7 +48,7 @@
*
* @since 21-Apr-2007
*/
-public class CXFServletExt extends CXFServlet
+public class CXFServletExt extends CXFServlet implements ServletDelegate
{
protected Endpoint endpoint;
@@ -95,6 +99,46 @@
{
ServletHelper.callPreDestroy(endpoint);
}
-
+ @Override
+ public void doHead(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doHead(request, response);
+ }
+
+ @Override
+ public void doGet(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doGet(request, response);
+ }
+
+ @Override
+ public void doPost(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doPost(request, response);
+ }
+
+ @Override
+ public void doPut(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doPut(request, response);
+ }
+
+ @Override
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.doDelete(request, response);
+ }
+
+ @Override
+ public void service(HttpServletRequest request, HttpServletResponse response, ServletContext context)
+ throws ServletException, IOException
+ {
+ this.service(request, response);
+ }
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerEJB3.java 2011-04-14 15:39:55 UTC (rev 14098)
@@ -24,10 +24,7 @@
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.invocation.InvocationType;
-import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
/**
* An XFire invoker for EJB3
@@ -40,8 +37,6 @@
{
protected WebServiceContext getWebServiceContext(MessageContext msgCtx)
{
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- WebServiceContextFactory contextFactory = spiProvider.getSPI(WebServiceContextFactory.class);
- return contextFactory.newWebServiceContext(InvocationType.JAXWS_EJB3, msgCtx);
+ return getWebServiceContextFactory().newWebServiceContext(InvocationType.JAXWS_EJB3, msgCtx);
}
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/InvokerJSE.java 2011-04-14 15:39:55 UTC (rev 14098)
@@ -24,10 +24,7 @@
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.invocation.InvocationType;
-import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
/**
* An CXF invoker for JSE
@@ -40,8 +37,6 @@
{
protected WebServiceContext getWebServiceContext(MessageContext msgCtx)
{
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- WebServiceContextFactory contextFactory = spiProvider.getSPI(WebServiceContextFactory.class);
- return contextFactory.newWebServiceContext(InvocationType.JAXWS_JSE, msgCtx);
+ return getWebServiceContextFactory().newWebServiceContext(InvocationType.JAXWS_JSE, msgCtx);
}
}
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ServletControllerExt.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ServletControllerExt.java 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/ServletControllerExt.java 2011-04-14 15:39:55 UTC (rev 14098)
@@ -41,6 +41,7 @@
import org.apache.cxf.transports.http.QueryHandlerRegistry;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.management.EndpointMetrics;
import org.jboss.wsf.spi.management.ServerConfig;
@@ -63,8 +64,9 @@
super(cxfTransport, config, servletCtx, bus);
this.cxfTransport = cxfTransport;
this.bus = bus;
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- serverConfig = spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
+ ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ serverConfig = spiProvider.getSPI(ServerConfigFactory.class, cl).getServerConfig();
}
/**
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2011-04-14 15:39:55 UTC (rev 14098)
@@ -71,8 +71,11 @@
String jbosswsCxfXml = contextParams == null ? null : contextParams.get(BusHolder.PARAM_CXF_BEANS_URL);
BusHolder holder = null;
- //set the runtime classloader (pointing to the deployment unit) to allow CXF accessing to the classes
- SecurityActions.setContextClassLoader(dep.getRuntimeClassLoader());
+ //set the runtime classloader (pointing to the deployment unit) to allow CXF accessing to the classes;
+ //use origClassLoader (which on AS7 is set to ASIL aggregation module's classloader by TCCLDeploymentProcessClassLoader) as
+ //parent to make sure user provided libs in the deployment do no mess up the WS endpoint's deploy if they duplicates
+ //libraries already available on the application server modules.
+ SecurityActions.setContextClassLoader(new DelegateClassLoader(dep.getRuntimeClassLoader(), origClassLoader));
if (jbosswsCxfXml != null) // Spring available
{
URL cxfServletURL = null;
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2011-04-14 15:39:55 UTC (rev 14098)
@@ -45,6 +45,7 @@
import org.jboss.wsf.common.injection.InjectionHelper;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.Deployment.DeploymentType;
import org.jboss.wsf.spi.invocation.EndpointAssociation;
@@ -66,8 +67,9 @@
public static Endpoint initEndpoint(ServletConfig servletConfig, String servletName)
{
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- EndpointRegistry epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class).getEndpointRegistry();
+ ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
+ SPIProvider spiProvider = SPIProviderResolver.getInstance(cl).getProvider();
+ EndpointRegistry epRegistry = spiProvider.getSPI(EndpointRegistryFactory.class, cl).getEndpointRegistry();
ServletContext context = servletConfig.getServletContext();
String contextPath = context.getContextPath();
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml 2011-04-14 15:39:55 UTC (rev 14098)
@@ -34,6 +34,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/cxf/aegis/jaxws/WEB-INF/">
<include name="jbossws-cxf.xml"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<war
@@ -44,6 +47,9 @@
<include name="org/jboss/test/ws/jaxws/cxf/aegis/AegisAnnotationGroupQueryImpl.class"/>
<include name="org/jboss/test/ws/jaxws/cxf/aegis/Member.class"/>
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<!-- jaxws-cxf-configuration -->
@@ -58,6 +64,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/cxf/configuration/WEB-INF">
<include name="jbossws-cxf.xml"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<!-- jaxws-cxf-descriptor -->
@@ -72,6 +81,9 @@
<webinf dir="${tests.output.dir}/test-resources/jaxws/cxf/descriptor/WEB-INF">
<include name="jbossws-cxf.xml"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<!-- jaxws-cxf-interop-wstrust10-client -->
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml 2011-04-14 15:39:55 UTC (rev 14098)
@@ -108,6 +108,9 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wsse-sign-client -->
@@ -135,6 +138,9 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wsse-sign-encrypt-client -->
@@ -158,6 +164,9 @@
<include name="jbossws-cxf.xml"/>
<include name="wsdl/*"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wsse-username-authorize -->
@@ -260,6 +269,9 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssePolicy-sign-client -->
@@ -287,6 +299,9 @@
<include name="bob.jks" />
<include name="bob.properties" />
</zipfileset>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- jaxws-samples-wssePolicy-sign-encrypt-client -->
@@ -310,6 +325,9 @@
<include name="jbossws-cxf.xml"/>
<include name="wsdl/*"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.ws.security"/>
+ </manifest>
</war>
<!-- Please add alphabetically -->
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-04-14 15:36:32 UTC (rev 14097)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-04-14 15:39:55 UTC (rev 14098)
@@ -84,6 +84,9 @@
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/cxf/gzip/HelloWorld*.class"/>
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-gzip-client.war"
manifest="${tests.output.dir}/test-resources/jaxws/cxf/gzip/META-INF/MANIFEST.MF"
13 years
JBossWS SVN: r14097 - in stack/cxf/trunk: modules/client and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 11:36:32 -0400 (Thu, 14 Apr 2011)
New Revision: 14097
Modified:
stack/cxf/trunk/modules/client/pom.xml
stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
stack/cxf/trunk/modules/server/pom.xml
stack/cxf/trunk/pom.xml
Log:
[JBWS-3266] Update to javax.xml.stream:stax-api:1.0-2
Modified: stack/cxf/trunk/modules/client/pom.xml
===================================================================
--- stack/cxf/trunk/modules/client/pom.xml 2011-04-14 15:33:37 UTC (rev 14096)
+++ stack/cxf/trunk/modules/client/pom.xml 2011-04-14 15:36:32 UTC (rev 14097)
@@ -126,7 +126,7 @@
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
- <groupId>stax</groupId>
+ <groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
</dependency>
<dependency>
Modified: stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
===================================================================
--- stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2011-04-14 15:33:37 UTC (rev 14096)
+++ stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2011-04-14 15:36:32 UTC (rev 14097)
@@ -71,7 +71,7 @@
<include>commons-beanutils:commons-beanutils:jar</include>
<include>commons-lang:commons-lang:jar</include>
<include>jboss.jaxbintros:jboss-jaxb-intros</include>
- <include>stax:stax-api:jar</include>
+ <include>javax.xml.stream:stax-api:jar</include>
<include>javax.jws:jsr181-api:jar</include>
</includes>
<outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
Modified: stack/cxf/trunk/modules/server/pom.xml
===================================================================
--- stack/cxf/trunk/modules/server/pom.xml 2011-04-14 15:33:37 UTC (rev 14096)
+++ stack/cxf/trunk/modules/server/pom.xml 2011-04-14 15:36:32 UTC (rev 14097)
@@ -142,7 +142,7 @@
<artifactId>jboss-jaxrpc-api_1.1_spec</artifactId>
</dependency>
<dependency>
- <groupId>stax</groupId>
+ <groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
</dependency>
<dependency>
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2011-04-14 15:33:37 UTC (rev 14096)
+++ stack/cxf/trunk/pom.xml 2011-04-14 15:36:32 UTC (rev 14097)
@@ -57,7 +57,6 @@
<!-- END -->
<jboss700.version>7.0.0.Beta3-SNAPSHOT</jboss700.version>
<cxf.version>2.3.3-patch-01</cxf.version>
- <cxf.stax.version>1.0.1</cxf.stax.version>
<cxf.asm.version>3.3</cxf.asm.version>
<cxf.xjcplugins.version>2.3.2</cxf.xjcplugins.version>
<fastinfoset.api.version>1.2.7</fastinfoset.api.version>
@@ -82,6 +81,7 @@
<log4j.version>1.2.14</log4j.version>
<mail.version>1.4.2</mail.version>
<saaj.api.version>1.0.0.Final</saaj.api.version>
+ <stax.api.version>1.0-2</stax.api.version>
<jms.api.version>1.0.0.Final</jms.api.version>
<velocity.version>1.5</velocity.version>
<xerces.version>2.9.1</xerces.version>
@@ -946,9 +946,9 @@
<version>${commons-lang.version}</version>
</dependency>
<dependency>
- <groupId>stax</groupId>
+ <groupId>javax.xml.stream</groupId>
<artifactId>stax-api</artifactId>
- <version>${cxf.stax.version}</version>
+ <version>${stax.api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.santuario</groupId>
13 years
JBossWS SVN: r14096 - in shared-testsuite/trunk: src/test/ant-import and 14 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2011-04-14 11:33:37 -0400 (Thu, 14 Apr 2011)
New Revision: 14096
Added:
shared-testsuite/trunk/src/test/java/org/jboss/test/helper/
shared-testsuite/trunk/src/test/java/org/jboss/test/helper/DOMWriter.java
Removed:
shared-testsuite/trunk/src/test/java/org/jboss/test/helper/DOMWriter.java
Modified:
shared-testsuite/trunk/
shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml
shared-testsuite/trunk/src/test/ant-import/build-samples-jaxws.xml
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestServiceBean.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/provider/LogicalSourceHandler.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/provider/ProviderBeanPayload.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
Log:
[JBWS-3224][JBWS-3265] Isolate deployment classloader from ws server integration
Property changes on: shared-testsuite/trunk
___________________________________________________________________
Added: svn:mergeinfo
+ /shared-testsuite/branches/asoldano:14040-14045
Modified: shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml 2011-04-14 15:33:37 UTC (rev 14096)
@@ -378,6 +378,7 @@
<war warfile="${tests.output.dir}/test-libs/jaxws-jbws1807.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws1807/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
<include name="org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.class" />
+ <include name="org/jboss/test/helper/DOMWriter.class" />
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws1807/WEB-INF">
<include name="wsdl/**" />
@@ -1083,6 +1084,7 @@
<include name="org/jboss/test/ws/jaxws/namespace/EndpointBean.class" />
<include name="org/jboss/test/ws/jaxws/namespace/EndpointInterface.class" />
<include name="org/jboss/test/ws/jaxws/namespace/*.xml" />
+ <include name="org/jboss/test/helper/DOMWriter.class" />
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/namespace/WEB-INF">
<include name="jboss-web.xml" />
Modified: shared-testsuite/trunk/src/test/ant-import/build-samples-jaxws.xml
===================================================================
--- shared-testsuite/trunk/src/test/ant-import/build-samples-jaxws.xml 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/ant-import/build-samples-jaxws.xml 2011-04-14 15:33:37 UTC (rev 14096)
@@ -175,6 +175,9 @@
<include name="org/jboss/test/ws/jaxws/samples/logicalhandler/ObjectFactory.class"/>
<include name="org/jboss/test/ws/jaxws/samples/logicalhandler/jaxws-server-jaxb-handlers.xml"/>
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="com.sun.xml.bind export services"/>
+ </manifest>
</war>
<!-- jaxws-samples-oneway -->
Deleted: shared-testsuite/trunk/src/test/java/org/jboss/test/helper/DOMWriter.java
===================================================================
--- shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/helper/DOMWriter.java 2011-04-08 15:52:49 UTC (rev 14045)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/helper/DOMWriter.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -1,671 +0,0 @@
-/*
- * ====================================================================
- *
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact apache(a)apache.org.
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.jboss.test.helper;
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Traverse a DOM tree in order to print a document that is parsed.
- *
- * @author Andy Clark, IBM
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:mvecera@redhat.com">Martin Vecera</a>
- * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
- */
-@SuppressWarnings("unchecked")
-public class DOMWriter
-{
- private static final Pattern PATTERN = Pattern.compile("[&<>'\"\r\n]");
- // Print writer
- private PrintWriter out;
- // True, if canonical output
- private boolean canonical;
- // True, if pretty printing should be used
- private boolean prettyprint;
- // True, if the XML declaration should be written
- private boolean writeXMLDeclaration;
- // True, if whitespace should be ignored
- private boolean ignoreWhitespace;
- // Explicit character set encoding
- private String charsetName;
- // indent for the pretty printer
- private int prettyIndent;
- // True, if the XML declaration has been written
- private boolean wroteXMLDeclaration;
- // The node that started the write
- private Node rootNode;
- // True if we want namespace completion
- private boolean completeNamespaces = true;
- // The current default namespace
- private String currentDefaultNamespace;
-
- public DOMWriter(Writer w)
- {
- this.out = new PrintWriter(w);
- }
-
- public DOMWriter(Writer w, String charsetName)
- {
- this.out = new PrintWriter(w);
- this.charsetName = charsetName;
- this.writeXMLDeclaration = true;
- }
-
- public DOMWriter(OutputStream stream)
- {
- try
- {
- this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
- }
- catch (UnsupportedEncodingException e)
- {
- // ignore, UTF-8 should be available
- }
- }
-
- public DOMWriter(OutputStream stream, String charsetName)
- {
- try
- {
- this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
- this.charsetName = charsetName;
- this.writeXMLDeclaration = true;
- }
- catch (UnsupportedEncodingException e)
- {
- throw new IllegalArgumentException("Unsupported encoding: " + charsetName);
- }
- }
-
- /**
- * Print a node with explicit prettyprinting.
- * The defaults for all other DOMWriter properties apply.
- *
- */
- public static String printNode(Node node, boolean prettyprint)
- {
- StringWriter strw = new StringWriter();
- new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
- return strw.toString();
- }
-
- public boolean isCanonical()
- {
- return canonical;
- }
-
- /**
- * Set wheter entities should appear in their canonical form.
- * The default is false.
- */
- public DOMWriter setCanonical(boolean canonical)
- {
- this.canonical = canonical;
- return this;
- }
-
- public boolean isIgnoreWhitespace()
- {
- return ignoreWhitespace;
- }
-
- /**
- * Set whether whitespace should be ignored.
- * The default is false.
- */
- public DOMWriter setIgnoreWhitespace(boolean ignoreWhitespace)
- {
- this.ignoreWhitespace = ignoreWhitespace;
- return this;
- }
-
- /**
- * Set wheter subelements should have their namespaces completed.
- * Setting this to false may lead to invalid XML fragments.
- * The default is true.
- */
- public DOMWriter setCompleteNamespaces(boolean complete)
- {
- this.completeNamespaces = complete;
- return this;
- }
-
- public boolean isPrettyprint()
- {
- return prettyprint;
- }
-
- /**
- * Set wheter element should be indented.
- * The default is false.
- */
- public DOMWriter setPrettyprint(boolean prettyprint)
- {
- this.prettyprint = prettyprint;
- return this;
- }
-
- public boolean isWriteXMLDeclaration()
- {
- return writeXMLDeclaration;
- }
-
- /**
- * Set wheter the XML declaration should be written.
- * The default is false.
- */
- public DOMWriter setWriteXMLDeclaration(boolean flag)
- {
- this.writeXMLDeclaration = flag;
- return this;
- }
-
- public void print(Node node)
- {
- if (prettyprint && ignoreWhitespace)
- throw new IllegalStateException("Cannot pretty print and ignore whitespace");
-
- rootNode = node;
- printInternal(node, false);
- }
-
- private void printInternal(Node node, boolean indentEndMarker)
- {
- // is there anything to do?
- if (node == null)
- {
- return;
- }
-
- // JBAS-2117 - Don't skip the DOCUMENT_NODE
- // if (node instanceof Document) node = ((Document)node).getDocumentElement();
-
- if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false)
- {
- out.print("<?xml version='1.0'");
- if (charsetName != null)
- out.print(" encoding='" + charsetName + "'");
-
- out.print("?>");
- if (prettyprint)
- out.println();
-
- wroteXMLDeclaration = true;
- }
-
- int type = node.getNodeType();
- boolean hasChildNodes = node.getChildNodes().getLength() > 0;
-
- String nodeName = node.getNodeName();
- switch (type)
- {
- // print document
- case Node.DOCUMENT_NODE:
- {
- NodeList children = node.getChildNodes();
- int len = children.getLength();
- for (int iChild = 0; iChild < len; iChild++)
- {
- printInternal(children.item(iChild), false);
- }
- out.flush();
- break;
- }
-
- // print element with attributes
- case Node.ELEMENT_NODE:
- {
- Element element = (Element)node;
- if (prettyprint)
- {
- for (int i = 0; i < prettyIndent; i++)
- {
- out.print(' ');
- }
- prettyIndent++;
- }
-
- out.print('<');
- out.print(nodeName);
-
- Map nsMap = new HashMap();
- String elPrefix = node.getPrefix();
- String elNamespaceURI = node.getNamespaceURI();
- if (elPrefix != null)
- {
- String nsURI = getNamespaceURI(elPrefix, element, rootNode);
- nsMap.put(elPrefix, nsURI);
- }
-
- Attr attrs[] = sortAttributes(node.getAttributes());
- for (int i = 0; i < attrs.length; i++)
- {
- Attr attr = attrs[i];
- String atPrefix = attr.getPrefix();
- String atName = attr.getNodeName();
- String atValue = normalize(attr.getNodeValue(), canonical);
-
- if (atName.equals("xmlns"))
- currentDefaultNamespace = atValue;
-
- if (atPrefix != null && !atPrefix.equals("xmlns") && !atPrefix.equals("xml"))
- {
- String nsURI = getNamespaceURI(atPrefix, element, rootNode);
- nsMap.put(atPrefix, nsURI);
- // xsi:type='ns1:SubType', xsi:type='xsd:string'
- if (atName.equals(atPrefix + ":type") && atValue.indexOf(":") > 0)
- {
- // xsi defined on the envelope
- if (nsURI == null)
- nsURI = getNamespaceURI(atPrefix, element, null);
-
- if ("http://www.w3.org/2001/XMLSchema-instance".equals(nsURI))
- {
- String typePrefix = atValue.substring(0, atValue.indexOf(":"));
- String typeURI = getNamespaceURI(typePrefix, element, rootNode);
- nsMap.put(typePrefix, typeURI);
- }
- }
- }
-
- out.print(" " + atName + "='" + atValue + "'");
- }
-
- // Add namespace declaration for prefixes
- // that are defined further up the tree
- if (completeNamespaces)
- {
- Iterator itPrefix = nsMap.keySet().iterator();
- while (itPrefix.hasNext())
- {
- String prefix = (String)itPrefix.next();
- String nsURI = (String)nsMap.get(prefix);
- if (nsURI == null)
- {
- nsURI = getNamespaceURI(prefix, element, null);
- out.print(" xmlns:" + prefix + "='" + nsURI + "'");
- }
- }
- }
-
- // The SAX ContentHandler will by default not add the namespace declaration
- // <Hello xmlns='http://somens'>World</Hello>
- if (elPrefix == null && elNamespaceURI != null)
- {
- String defaultNamespace = element.getAttribute("xmlns");
- if (defaultNamespace.length() == 0 && !elNamespaceURI.equals(currentDefaultNamespace))
- {
- out.print(" xmlns='" + elNamespaceURI + "'");
- currentDefaultNamespace = elNamespaceURI;
- }
- }
-
- if (hasChildNodes)
- {
- out.print('>');
- }
-
- // Find out if the end marker is indented
- indentEndMarker = isEndMarkerIndented(node);
-
- if (indentEndMarker)
- {
- out.print('\n');
- }
-
- NodeList childNodes = node.getChildNodes();
- int len = childNodes.getLength();
- for (int i = 0; i < len; i++)
- {
- Node childNode = childNodes.item(i);
- printInternal(childNode, false);
- }
- break;
- }
-
- // handle entity reference nodes
- case Node.ENTITY_REFERENCE_NODE:
- {
- if (canonical)
- {
- NodeList children = node.getChildNodes();
- if (children != null)
- {
- int len = children.getLength();
- for (int i = 0; i < len; i++)
- {
- printInternal(children.item(i), false);
- }
- }
- }
- else
- {
- out.print('&');
- out.print(nodeName);
- out.print(';');
- }
- break;
- }
-
- // print cdata sections
- case Node.CDATA_SECTION_NODE:
- {
- if (canonical)
- {
- out.print(normalize(node.getNodeValue(), canonical));
- }
- else
- {
- out.print("<![CDATA[");
- out.print(node.getNodeValue());
- out.print("]]>");
- }
- break;
- }
-
- // print text
- case Node.TEXT_NODE:
- {
- String text = normalize(node.getNodeValue(), canonical);
- if (text.trim().length() > 0)
- {
- out.print(text);
- }
- else if (prettyprint == false && ignoreWhitespace == false)
- {
- out.print(text);
- }
- break;
- }
-
- // print processing instruction
- case Node.PROCESSING_INSTRUCTION_NODE:
- {
- out.print("<?");
- out.print(nodeName);
- String data = node.getNodeValue();
- if (data != null && data.length() > 0)
- {
- out.print(' ');
- out.print(data);
- }
- out.print("?>");
- break;
- }
-
- // print comment
- case Node.COMMENT_NODE:
- {
- for (int i = 0; i < prettyIndent; i++)
- {
- out.print(' ');
- }
-
- out.print("<!--");
- String data = node.getNodeValue();
- if (data != null)
- {
- out.print(data);
- }
- out.print("-->");
-
- if (prettyprint)
- {
- out.print('\n');
- }
-
- break;
- }
- }
-
- if (type == Node.ELEMENT_NODE)
- {
- if (prettyprint)
- prettyIndent--;
-
- if (hasChildNodes == false)
- {
- out.print("/>");
- }
- else
- {
- if (indentEndMarker)
- {
- for (int i = 0; i < prettyIndent; i++)
- {
- out.print(' ');
- }
- }
-
- out.print("</");
- out.print(nodeName);
- out.print('>');
- }
-
- if (prettyIndent > 0)
- {
- out.print('\n');
- }
- }
- out.flush();
- }
-
- private String getNamespaceURI(String prefix, Element element, Node stopNode)
- {
- Node parent = element.getParentNode();
- String nsURI = element.getAttribute("xmlns:" + prefix);
- if (nsURI.length() == 0 && element != stopNode && parent instanceof Element)
- return getNamespaceURI(prefix, (Element)parent, stopNode);
-
- return (nsURI.length() > 0 ? nsURI : null);
- }
-
- private boolean isEndMarkerIndented(Node node)
- {
- if (prettyprint)
- {
- NodeList childNodes = node.getChildNodes();
- int len = childNodes.getLength();
- for (int i = 0; i < len; i++)
- {
- Node children = childNodes.item(i);
- if (children.getNodeType() == Node.ELEMENT_NODE)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- /** Returns a sorted list of attributes. */
- private Attr[] sortAttributes(NamedNodeMap attrs)
- {
-
- int len = (attrs != null) ? attrs.getLength() : 0;
- Attr array[] = new Attr[len];
- for (int i = 0; i < len; i++)
- {
- array[i] = (Attr)attrs.item(i);
- }
- for (int i = 0; i < len - 1; i++)
- {
- String name = array[i].getNodeName();
- int index = i;
- for (int j = i + 1; j < len; j++)
- {
- String curName = array[j].getNodeName();
- if (curName.compareTo(name) < 0)
- {
- name = curName;
- index = j;
- }
- }
- if (index != i)
- {
- Attr temp = array[i];
- array[i] = array[index];
- array[index] = temp;
- }
- }
- return (array);
- }
-
- /** Normalizes the given string. */
- public static String normalize(String strValue, boolean canonical)
- {
- Matcher m = PATTERN.matcher(strValue);
- if (m.find())
- {
- int pos = m.start(); // we can use previous match to skip some part at the string beginning
- int len = strValue.length(); // just a single call to length()
- char[] input = new char[len]; // this is to ommit calls to String.charAt()
- strValue.getChars(0, len, input, 0);
- StringBuilder sb = new StringBuilder(len * 3); // faster than StringBuffer, not thread safe
-
- int copyStart = 0;
-
- for (int i = pos; i < len; i++)
- {
- char ch = input[i];
- switch (ch)
- {
- case '<' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append("<");
- break;
- case '>' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append(">");
- break;
- case '"' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append(""");
- break;
- case '\'' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append("'");
- break;
- case '&' :
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append("&");
- break;
- case '\r' :
- case '\n' :
- if (canonical)
- {
- if (copyStart < i)
- {
- sb.append(input, copyStart, i - copyStart);
- }
- copyStart = i + 1;
- sb.append("&#");
- sb.append(Integer.toString(ch));
- sb.append(';');
- break;
- }
-
- }
- }
- if (copyStart < len)
- {
- sb.append(input, copyStart, len - copyStart);
- }
-
- return sb.toString();
- }
- else
- {
- return strValue;
- }
- }
-}
Copied: shared-testsuite/trunk/src/test/java/org/jboss/test/helper/DOMWriter.java (from rev 14045, shared-testsuite/branches/asoldano/src/test/java/org/jboss/test/helper/DOMWriter.java)
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/helper/DOMWriter.java (rev 0)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/helper/DOMWriter.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -0,0 +1,671 @@
+/*
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.jboss.test.helper;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Traverse a DOM tree in order to print a document that is parsed.
+ *
+ * @author Andy Clark, IBM
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:mvecera@redhat.com">Martin Vecera</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
+ */
+@SuppressWarnings("unchecked")
+public class DOMWriter
+{
+ private static final Pattern PATTERN = Pattern.compile("[&<>'\"\r\n]");
+ // Print writer
+ private PrintWriter out;
+ // True, if canonical output
+ private boolean canonical;
+ // True, if pretty printing should be used
+ private boolean prettyprint;
+ // True, if the XML declaration should be written
+ private boolean writeXMLDeclaration;
+ // True, if whitespace should be ignored
+ private boolean ignoreWhitespace;
+ // Explicit character set encoding
+ private String charsetName;
+ // indent for the pretty printer
+ private int prettyIndent;
+ // True, if the XML declaration has been written
+ private boolean wroteXMLDeclaration;
+ // The node that started the write
+ private Node rootNode;
+ // True if we want namespace completion
+ private boolean completeNamespaces = true;
+ // The current default namespace
+ private String currentDefaultNamespace;
+
+ public DOMWriter(Writer w)
+ {
+ this.out = new PrintWriter(w);
+ }
+
+ public DOMWriter(Writer w, String charsetName)
+ {
+ this.out = new PrintWriter(w);
+ this.charsetName = charsetName;
+ this.writeXMLDeclaration = true;
+ }
+
+ public DOMWriter(OutputStream stream)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ // ignore, UTF-8 should be available
+ }
+ }
+
+ public DOMWriter(OutputStream stream, String charsetName)
+ {
+ try
+ {
+ this.out = new PrintWriter(new OutputStreamWriter(stream, charsetName));
+ this.charsetName = charsetName;
+ this.writeXMLDeclaration = true;
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new IllegalArgumentException("Unsupported encoding: " + charsetName);
+ }
+ }
+
+ /**
+ * Print a node with explicit prettyprinting.
+ * The defaults for all other DOMWriter properties apply.
+ *
+ */
+ public static String printNode(Node node, boolean prettyprint)
+ {
+ StringWriter strw = new StringWriter();
+ new DOMWriter(strw).setPrettyprint(prettyprint).print(node);
+ return strw.toString();
+ }
+
+ public boolean isCanonical()
+ {
+ return canonical;
+ }
+
+ /**
+ * Set wheter entities should appear in their canonical form.
+ * The default is false.
+ */
+ public DOMWriter setCanonical(boolean canonical)
+ {
+ this.canonical = canonical;
+ return this;
+ }
+
+ public boolean isIgnoreWhitespace()
+ {
+ return ignoreWhitespace;
+ }
+
+ /**
+ * Set whether whitespace should be ignored.
+ * The default is false.
+ */
+ public DOMWriter setIgnoreWhitespace(boolean ignoreWhitespace)
+ {
+ this.ignoreWhitespace = ignoreWhitespace;
+ return this;
+ }
+
+ /**
+ * Set wheter subelements should have their namespaces completed.
+ * Setting this to false may lead to invalid XML fragments.
+ * The default is true.
+ */
+ public DOMWriter setCompleteNamespaces(boolean complete)
+ {
+ this.completeNamespaces = complete;
+ return this;
+ }
+
+ public boolean isPrettyprint()
+ {
+ return prettyprint;
+ }
+
+ /**
+ * Set wheter element should be indented.
+ * The default is false.
+ */
+ public DOMWriter setPrettyprint(boolean prettyprint)
+ {
+ this.prettyprint = prettyprint;
+ return this;
+ }
+
+ public boolean isWriteXMLDeclaration()
+ {
+ return writeXMLDeclaration;
+ }
+
+ /**
+ * Set wheter the XML declaration should be written.
+ * The default is false.
+ */
+ public DOMWriter setWriteXMLDeclaration(boolean flag)
+ {
+ this.writeXMLDeclaration = flag;
+ return this;
+ }
+
+ public void print(Node node)
+ {
+ if (prettyprint && ignoreWhitespace)
+ throw new IllegalStateException("Cannot pretty print and ignore whitespace");
+
+ rootNode = node;
+ printInternal(node, false);
+ }
+
+ private void printInternal(Node node, boolean indentEndMarker)
+ {
+ // is there anything to do?
+ if (node == null)
+ {
+ return;
+ }
+
+ // JBAS-2117 - Don't skip the DOCUMENT_NODE
+ // if (node instanceof Document) node = ((Document)node).getDocumentElement();
+
+ if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false)
+ {
+ out.print("<?xml version='1.0'");
+ if (charsetName != null)
+ out.print(" encoding='" + charsetName + "'");
+
+ out.print("?>");
+ if (prettyprint)
+ out.println();
+
+ wroteXMLDeclaration = true;
+ }
+
+ int type = node.getNodeType();
+ boolean hasChildNodes = node.getChildNodes().getLength() > 0;
+
+ String nodeName = node.getNodeName();
+ switch (type)
+ {
+ // print document
+ case Node.DOCUMENT_NODE:
+ {
+ NodeList children = node.getChildNodes();
+ int len = children.getLength();
+ for (int iChild = 0; iChild < len; iChild++)
+ {
+ printInternal(children.item(iChild), false);
+ }
+ out.flush();
+ break;
+ }
+
+ // print element with attributes
+ case Node.ELEMENT_NODE:
+ {
+ Element element = (Element)node;
+ if (prettyprint)
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+ prettyIndent++;
+ }
+
+ out.print('<');
+ out.print(nodeName);
+
+ Map nsMap = new HashMap();
+ String elPrefix = node.getPrefix();
+ String elNamespaceURI = node.getNamespaceURI();
+ if (elPrefix != null)
+ {
+ String nsURI = getNamespaceURI(elPrefix, element, rootNode);
+ nsMap.put(elPrefix, nsURI);
+ }
+
+ Attr attrs[] = sortAttributes(node.getAttributes());
+ for (int i = 0; i < attrs.length; i++)
+ {
+ Attr attr = attrs[i];
+ String atPrefix = attr.getPrefix();
+ String atName = attr.getNodeName();
+ String atValue = normalize(attr.getNodeValue(), canonical);
+
+ if (atName.equals("xmlns"))
+ currentDefaultNamespace = atValue;
+
+ if (atPrefix != null && !atPrefix.equals("xmlns") && !atPrefix.equals("xml"))
+ {
+ String nsURI = getNamespaceURI(atPrefix, element, rootNode);
+ nsMap.put(atPrefix, nsURI);
+ // xsi:type='ns1:SubType', xsi:type='xsd:string'
+ if (atName.equals(atPrefix + ":type") && atValue.indexOf(":") > 0)
+ {
+ // xsi defined on the envelope
+ if (nsURI == null)
+ nsURI = getNamespaceURI(atPrefix, element, null);
+
+ if ("http://www.w3.org/2001/XMLSchema-instance".equals(nsURI))
+ {
+ String typePrefix = atValue.substring(0, atValue.indexOf(":"));
+ String typeURI = getNamespaceURI(typePrefix, element, rootNode);
+ nsMap.put(typePrefix, typeURI);
+ }
+ }
+ }
+
+ out.print(" " + atName + "='" + atValue + "'");
+ }
+
+ // Add namespace declaration for prefixes
+ // that are defined further up the tree
+ if (completeNamespaces)
+ {
+ Iterator itPrefix = nsMap.keySet().iterator();
+ while (itPrefix.hasNext())
+ {
+ String prefix = (String)itPrefix.next();
+ String nsURI = (String)nsMap.get(prefix);
+ if (nsURI == null)
+ {
+ nsURI = getNamespaceURI(prefix, element, null);
+ out.print(" xmlns:" + prefix + "='" + nsURI + "'");
+ }
+ }
+ }
+
+ // The SAX ContentHandler will by default not add the namespace declaration
+ // <Hello xmlns='http://somens'>World</Hello>
+ if (elPrefix == null && elNamespaceURI != null)
+ {
+ String defaultNamespace = element.getAttribute("xmlns");
+ if (defaultNamespace.length() == 0 && !elNamespaceURI.equals(currentDefaultNamespace))
+ {
+ out.print(" xmlns='" + elNamespaceURI + "'");
+ currentDefaultNamespace = elNamespaceURI;
+ }
+ }
+
+ if (hasChildNodes)
+ {
+ out.print('>');
+ }
+
+ // Find out if the end marker is indented
+ indentEndMarker = isEndMarkerIndented(node);
+
+ if (indentEndMarker)
+ {
+ out.print('\n');
+ }
+
+ NodeList childNodes = node.getChildNodes();
+ int len = childNodes.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node childNode = childNodes.item(i);
+ printInternal(childNode, false);
+ }
+ break;
+ }
+
+ // handle entity reference nodes
+ case Node.ENTITY_REFERENCE_NODE:
+ {
+ if (canonical)
+ {
+ NodeList children = node.getChildNodes();
+ if (children != null)
+ {
+ int len = children.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ printInternal(children.item(i), false);
+ }
+ }
+ }
+ else
+ {
+ out.print('&');
+ out.print(nodeName);
+ out.print(';');
+ }
+ break;
+ }
+
+ // print cdata sections
+ case Node.CDATA_SECTION_NODE:
+ {
+ if (canonical)
+ {
+ out.print(normalize(node.getNodeValue(), canonical));
+ }
+ else
+ {
+ out.print("<![CDATA[");
+ out.print(node.getNodeValue());
+ out.print("]]>");
+ }
+ break;
+ }
+
+ // print text
+ case Node.TEXT_NODE:
+ {
+ String text = normalize(node.getNodeValue(), canonical);
+ if (text.trim().length() > 0)
+ {
+ out.print(text);
+ }
+ else if (prettyprint == false && ignoreWhitespace == false)
+ {
+ out.print(text);
+ }
+ break;
+ }
+
+ // print processing instruction
+ case Node.PROCESSING_INSTRUCTION_NODE:
+ {
+ out.print("<?");
+ out.print(nodeName);
+ String data = node.getNodeValue();
+ if (data != null && data.length() > 0)
+ {
+ out.print(' ');
+ out.print(data);
+ }
+ out.print("?>");
+ break;
+ }
+
+ // print comment
+ case Node.COMMENT_NODE:
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+
+ out.print("<!--");
+ String data = node.getNodeValue();
+ if (data != null)
+ {
+ out.print(data);
+ }
+ out.print("-->");
+
+ if (prettyprint)
+ {
+ out.print('\n');
+ }
+
+ break;
+ }
+ }
+
+ if (type == Node.ELEMENT_NODE)
+ {
+ if (prettyprint)
+ prettyIndent--;
+
+ if (hasChildNodes == false)
+ {
+ out.print("/>");
+ }
+ else
+ {
+ if (indentEndMarker)
+ {
+ for (int i = 0; i < prettyIndent; i++)
+ {
+ out.print(' ');
+ }
+ }
+
+ out.print("</");
+ out.print(nodeName);
+ out.print('>');
+ }
+
+ if (prettyIndent > 0)
+ {
+ out.print('\n');
+ }
+ }
+ out.flush();
+ }
+
+ private String getNamespaceURI(String prefix, Element element, Node stopNode)
+ {
+ Node parent = element.getParentNode();
+ String nsURI = element.getAttribute("xmlns:" + prefix);
+ if (nsURI.length() == 0 && element != stopNode && parent instanceof Element)
+ return getNamespaceURI(prefix, (Element)parent, stopNode);
+
+ return (nsURI.length() > 0 ? nsURI : null);
+ }
+
+ private boolean isEndMarkerIndented(Node node)
+ {
+ if (prettyprint)
+ {
+ NodeList childNodes = node.getChildNodes();
+ int len = childNodes.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node children = childNodes.item(i);
+ if (children.getNodeType() == Node.ELEMENT_NODE)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /** Returns a sorted list of attributes. */
+ private Attr[] sortAttributes(NamedNodeMap attrs)
+ {
+
+ int len = (attrs != null) ? attrs.getLength() : 0;
+ Attr array[] = new Attr[len];
+ for (int i = 0; i < len; i++)
+ {
+ array[i] = (Attr)attrs.item(i);
+ }
+ for (int i = 0; i < len - 1; i++)
+ {
+ String name = array[i].getNodeName();
+ int index = i;
+ for (int j = i + 1; j < len; j++)
+ {
+ String curName = array[j].getNodeName();
+ if (curName.compareTo(name) < 0)
+ {
+ name = curName;
+ index = j;
+ }
+ }
+ if (index != i)
+ {
+ Attr temp = array[i];
+ array[i] = array[index];
+ array[index] = temp;
+ }
+ }
+ return (array);
+ }
+
+ /** Normalizes the given string. */
+ public static String normalize(String strValue, boolean canonical)
+ {
+ Matcher m = PATTERN.matcher(strValue);
+ if (m.find())
+ {
+ int pos = m.start(); // we can use previous match to skip some part at the string beginning
+ int len = strValue.length(); // just a single call to length()
+ char[] input = new char[len]; // this is to ommit calls to String.charAt()
+ strValue.getChars(0, len, input, 0);
+ StringBuilder sb = new StringBuilder(len * 3); // faster than StringBuffer, not thread safe
+
+ int copyStart = 0;
+
+ for (int i = pos; i < len; i++)
+ {
+ char ch = input[i];
+ switch (ch)
+ {
+ case '<' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("<");
+ break;
+ case '>' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append(">");
+ break;
+ case '"' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append(""");
+ break;
+ case '\'' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("'");
+ break;
+ case '&' :
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("&");
+ break;
+ case '\r' :
+ case '\n' :
+ if (canonical)
+ {
+ if (copyStart < i)
+ {
+ sb.append(input, copyStart, i - copyStart);
+ }
+ copyStart = i + 1;
+ sb.append("&#");
+ sb.append(Integer.toString(ch));
+ sb.append(';');
+ break;
+ }
+
+ }
+ }
+ if (copyStart < len)
+ {
+ sb.append(input, copyStart, len - copyStart);
+ }
+
+ return sb.toString();
+ }
+ else
+ {
+ return strValue;
+ }
+ }
+}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -48,7 +48,7 @@
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestServiceBean.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestServiceBean.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestServiceBean.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -35,7 +35,7 @@
import javax.xml.transform.dom.DOMSource;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -30,7 +30,10 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.Endpoint;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.Service;
@@ -38,7 +41,7 @@
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -51,7 +54,6 @@
@SuppressWarnings("serial")
public class EndpointServlet extends HttpServlet
{
-
private Endpoint endpoint1;
private Endpoint endpoint2;
private static final String TEST_ELEMENT = "<fabrikam:CustomerKey xmlns:fabrikam='http://example.com/fabrikam'>123456789</fabrikam:CustomerKey>";
@@ -92,8 +94,9 @@
String retStr = port.echo(param);
//Test epr
- assertEndpointReference(endpoint1.getEndpointReference(DOMUtils.parse(TEST_ELEMENT)), TEST_ELEMENT);
- assertEndpointReference(endpoint1.getEndpointReference(W3CEndpointReference.class, (Element[])null), null);
+ DocumentBuilder builder = getDocumentBuilder();
+ assertEndpointReference(endpoint1.getEndpointReference(DOMUtils.parse(TEST_ELEMENT, builder)), TEST_ELEMENT, builder);
+ assertEndpointReference(endpoint1.getEndpointReference(W3CEndpointReference.class, (Element[])null), null, builder);
// Return the result
PrintWriter pw = new PrintWriter(res.getWriter());
@@ -101,11 +104,11 @@
pw.close();
}
- private void assertEndpointReference(EndpointReference epr, String refPar) throws IOException
+ private void assertEndpointReference(EndpointReference epr, String refPar, DocumentBuilder builder) throws IOException
{
Logger.getLogger(this.getClass()).info("epr: "+epr);
assert(W3CEndpointReference.class.getName().equals(epr.getClass().getName()));
- Element endpointReference = DOMUtils.parse(epr.toString());
+ Element endpointReference = DOMUtils.parse(epr.toString(), builder);
assert("EndpointReference".equals(endpointReference.getNodeName()));
assert("http://www.w3.org/2005/08/addressing".equals(endpointReference.getAttribute("xmlns")));
NodeList addresses = endpointReference.getElementsByTagName("Address");
@@ -116,4 +119,23 @@
assert(epr.toString().contains(refPar));
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1807/ProviderImpl.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -24,6 +24,9 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.BindingType;
@@ -34,8 +37,8 @@
import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.common.DOMWriter;
+import org.jboss.test.helper.DOMWriter;
+import org.jboss.wsf.util.DOMUtils;
@WebServiceProvider(wsdlLocation = "WEB-INF/wsdl/provider.wsdl", portName = "ProviderPort", serviceName = "ProviderService", targetNamespace = "http://ws.com/")
@ServiceMode(value = Service.Mode.PAYLOAD)
@@ -49,7 +52,7 @@
{
try
{
- String input = DOMWriter.printNode(DOMUtils.sourceToElement(source), false);
+ String input = DOMWriter.printNode(DOMUtils.sourceToElement(source, getDocumentBuilder()), false);
log.info("invoke: " + input);
String reply = "<reply>" + input + "</reply>";
@@ -60,4 +63,23 @@
throw new RuntimeException(ex);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1815/JBWS1815TestCase.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -25,6 +25,10 @@
import java.io.IOException;
import java.net.URL;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.soap.Detail;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConnection;
@@ -36,7 +40,7 @@
import junit.framework.Test;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
import org.w3c.dom.Element;
@@ -69,7 +73,7 @@
public void testWSDLAccess() throws Exception
{
URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
- Element wsdl = DOMUtils.parse(wsdlURL.openStream());
+ Element wsdl = DOMUtils.parse(wsdlURL.openStream(), getDocumentBuilder());
assertNotNull(wsdl);
}
@@ -98,5 +102,24 @@
SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(msgString.getBytes()));
return reqMsg;
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2960/JBWS2960TestCase.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -35,7 +35,7 @@
import junit.framework.Assert;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
import org.w3c.dom.Element;
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/namespace/CustomHandler.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -31,7 +31,7 @@
import javax.xml.ws.handler.soap.SOAPMessageContext;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMWriter;
+import org.jboss.test.helper.DOMWriter;
/**
* A simple SOAPHandler checking the exchanged message uses the SEI namespace.
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/AddressingPort.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -25,12 +25,15 @@
import java.rmi.RemoteException;
import java.util.Map;
+import javax.xml.XMLConstants;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.BindingProvider;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.common.addressing.MAP;
import org.jboss.wsf.common.addressing.MAPBuilder;
import org.jboss.wsf.common.addressing.MAPBuilderFactory;
@@ -109,7 +112,7 @@
}
try
{
- replyTo.addReferenceParameter(DOMUtils.parse(getClientIdElement(clientID)));
+ replyTo.addReferenceParameter(DOMUtils.parse(getClientIdElement(clientID), getDocumentBuilder()));
}
catch (IOException e)
{
@@ -162,4 +165,23 @@
buffer.append(">" + clientid + "</" + qualname + ">");
return buffer.toString();
}
+
+ private static DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/addressing/ServerHandler.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -26,13 +26,14 @@
import javax.xml.ws.handler.MessageContext.Scope;
import org.jboss.logging.Logger;
-import org.jboss.wsf.common.DOMUtils;
import org.jboss.wsf.common.addressing.MAP;
import org.jboss.wsf.common.addressing.MAPBuilder;
import org.jboss.wsf.common.addressing.MAPBuilderFactory;
import org.jboss.wsf.common.addressing.MAPEndpoint;
import org.jboss.wsf.common.handler.GenericSOAPHandler;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* A server side handler for the ws-addressing
@@ -65,10 +66,10 @@
if (obj instanceof Element)
{
Element el = (Element)obj;
- QName qname = DOMUtils.getElementQName(el);
+ QName qname = getElementQName(el);
if (qname.equals(IDQN))
{
- clientid = DOMUtils.getTextContent(el);
+ clientid = getTextContent(el);
}
}
else
@@ -101,4 +102,95 @@
return true;
}
+
+ // ---------------- DOM Util methods -------------------
+
+ /** Get the qname of the given node.
+ */
+ protected static QName getElementQName(Element el)
+ {
+ String qualifiedName = el.getNodeName();
+ return resolveQName(el, qualifiedName);
+ }
+
+ /** Transform the given qualified name into a QName
+ */
+ protected static QName resolveQName(Element el, String qualifiedName)
+ {
+ QName qname;
+ String prefix = "";
+ String namespaceURI = "";
+ String localPart = qualifiedName;
+
+ int colIndex = qualifiedName.indexOf(":");
+ if (colIndex > 0)
+ {
+ prefix = qualifiedName.substring(0, colIndex);
+ localPart = qualifiedName.substring(colIndex + 1);
+
+ if ("xmlns".equals(prefix))
+ {
+ namespaceURI = "URI:XML_PREDEFINED_NAMESPACE";
+ }
+ else
+ {
+ Element nsElement = el;
+ while (namespaceURI.equals("") && nsElement != null)
+ {
+ namespaceURI = nsElement.getAttribute("xmlns:" + prefix);
+ if (namespaceURI.equals(""))
+ nsElement = getParentElement(nsElement);
+ }
+ }
+
+ if (namespaceURI.equals("") && el.getNamespaceURI() != null)
+ {
+ namespaceURI = el.getNamespaceURI();
+ }
+
+ if (namespaceURI.equals(""))
+ throw new IllegalArgumentException("Cannot find namespace uri for: " + qualifiedName);
+ }
+ else
+ {
+ Element nsElement = el;
+ while (namespaceURI.equals("") && nsElement != null)
+ {
+ namespaceURI = nsElement.getAttribute("xmlns");
+ if (namespaceURI.equals(""))
+ nsElement = getParentElement(nsElement);
+ }
+ }
+
+ qname = new QName(namespaceURI, localPart, prefix);
+ return qname;
+ }
+
+ /** Gets parent element or null if there is none
+ */
+ protected static Element getParentElement(Node node)
+ {
+ Node parent = node.getParentNode();
+ return (parent instanceof Element ? (Element)parent : null);
+ }
+
+ /** Get the concatenated text content, or null.
+ */
+ protected static String getTextContent(Node node)
+ {
+ boolean hasTextContent = false;
+ StringBuilder buffer = new StringBuilder();
+ NodeList nlist = node.getChildNodes();
+ int len = nlist.getLength();
+ for (int i = 0; i < len; i++)
+ {
+ Node child = nlist.item(i);
+ if (child.getNodeType() == Node.TEXT_NODE)
+ {
+ buffer.append(child.getNodeValue());
+ hasTextContent = true;
+ }
+ }
+ return (hasTextContent ? buffer.toString() : null);
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointEJB.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -33,12 +33,15 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.spi.annotation.AuthMethod;
import org.jboss.wsf.spi.annotation.TransportGuarantee;
@@ -107,11 +110,11 @@
Element root = null;
if (wsdl instanceof InputSource)
{
- root = DOMUtils.parse((InputSource)wsdl);
+ root = DOMUtils.parse((InputSource)wsdl, getDocumentBuilder());
}
else if (wsdl instanceof URI)
{
- root = DOMUtils.parse(((URI)wsdl).toURL().openStream());
+ root = DOMUtils.parse(((URI)wsdl).toURL().openStream(), getDocumentBuilder());
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
new DOMWriter(out).setPrettyprint(true).print(root);
@@ -140,4 +143,23 @@
{
return wsCtx.isUserInRole(role);
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointJSE.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -31,12 +31,15 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.jboss.wsf.common.DOMWriter;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
@@ -84,11 +87,11 @@
Element root = null;
if (wsdl instanceof InputSource)
{
- root = DOMUtils.parse((InputSource)wsdl);
+ root = DOMUtils.parse((InputSource)wsdl, getDocumentBuilder());
}
else if (wsdl instanceof URI)
{
- root = DOMUtils.parse(((URI)wsdl).toURL().openStream());
+ root = DOMUtils.parse(((URI)wsdl).toURL().openStream(), getDocumentBuilder());
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
new DOMWriter(out).setPrettyprint(true).print(root);
@@ -118,4 +121,23 @@
{
return wsCtx.isUserInRole(role);
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/LogicalSourceHandler.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -24,6 +24,9 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@@ -34,7 +37,7 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.common.handler.GenericLogicalHandler;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
/**
@@ -72,7 +75,7 @@
tf.newTransformer().transform(source, new StreamResult(baos));
// Parse the payload and extract the value
- Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()), getDocumentBuilder());
String oldValue = DOMUtils.getTextContent(root);
String newValue = oldValue + ":" + direction + "LogicalHandler";
@@ -96,4 +99,23 @@
throw new WebServiceException(ex);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -21,10 +21,13 @@
*/
package org.jboss.test.ws.jaxws.samples.httpbinding;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
import javax.jws.HandlerChain;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
@@ -81,7 +84,7 @@
private void verifyRequest(String xml) throws IOException
{
- Element was = DOMUtils.parse(xml);
+ Element was = DOMUtils.parse(xml, getDocumentBuilder());
if(!"somePayload".equals(was.getLocalName())
|| !"http://org.jboss.ws/httpbinding".equals(was.getNamespaceURI())
@@ -90,5 +93,24 @@
throw new WebServiceException("Unexpected payload: " + xml);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/logicalhandler/LogicalSourceHandler.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -24,6 +24,9 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@@ -34,7 +37,7 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.common.handler.GenericLogicalHandler;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
/**
@@ -72,7 +75,7 @@
tf.newTransformer().transform(source, new StreamResult(baos));
// Parse the payload and extract the value
- Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()), getDocumentBuilder());
Element element = DOMUtils.getFirstChildElement(root);
String oldValue = DOMUtils.getTextContent(element);
@@ -97,4 +100,23 @@
throw new WebServiceException(ex);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/provider/LogicalSourceHandler.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/provider/LogicalSourceHandler.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/provider/LogicalSourceHandler.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -24,6 +24,9 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
@@ -34,7 +37,7 @@
import org.jboss.logging.Logger;
import org.jboss.wsf.common.handler.GenericLogicalHandler;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import org.w3c.dom.Element;
/**
@@ -72,7 +75,7 @@
tf.newTransformer().transform(source, new StreamResult(baos));
// Parse the payload and extract the value
- Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element root = DOMUtils.parse(new ByteArrayInputStream(baos.toByteArray()), getDocumentBuilder());
String oldValue = DOMUtils.getTextContent(root);
String newValue = oldValue + ":" + direction + ":LogicalSourceHandler";
@@ -96,4 +99,23 @@
throw new WebServiceException(ex);
}
}
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/provider/ProviderBeanPayload.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/provider/ProviderBeanPayload.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/provider/ProviderBeanPayload.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -22,7 +22,7 @@
package org.jboss.test.ws.jaxws.samples.provider;
import org.w3c.dom.Element;
-import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.util.DOMUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -30,6 +30,9 @@
import java.io.IOException;
import javax.jws.HandlerChain;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
@@ -81,7 +84,7 @@
private void verifyRequest(String xml) throws IOException
{
- Element was = DOMUtils.parse(xml);
+ Element was = DOMUtils.parse(xml, getDocumentBuilder());
if(!"somePayload".equals(was.getLocalName())
|| !"http://org.jboss.ws/provider".equals(was.getNamespaceURI())
@@ -89,6 +92,25 @@
{
throw new WebServiceException("Unexpected payload: " + xml);
}
-}
+ }
+
+ private DocumentBuilder getDocumentBuilder()
+ {
+ DocumentBuilderFactory factory = null;
+ try
+ {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ factory.setExpandEntityReferences(false);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ return builder;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to create document builder", e);
+ }
+ }
}
Modified: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2011-04-14 15:30:44 UTC (rev 14095)
+++ shared-testsuite/trunk/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2011-04-14 15:33:37 UTC (rev 14096)
@@ -23,7 +23,9 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -35,8 +37,6 @@
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
-import org.jboss.wsf.common.IOUtils;
-
@WebService(portName = "SaajServicePort", serviceName = "SaajService", wsdlLocation = "WEB-INF/wsdl/SaajService.wsdl", targetNamespace = "http://www.jboss.org/jbossws/saaj", endpointInterface = "org.jboss.test.ws.saaj.jbws3084.ServiceIface")
public class ServiceImpl implements ServiceIface
{
@@ -93,7 +93,7 @@
{
InputStream is = entry.getValue().getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- IOUtils.copyStream(baos, is);
+ copyStream(baos, is);
String name = Integer.toString(index++);
DataHandler handler = new DataHandler(new InputStreamDataSource(
new ByteArrayInputStream(baos.toByteArray()), "text/plain", name));
@@ -107,4 +107,25 @@
return "Hello World!";
}
+
+ public static void copyStream(OutputStream outs, InputStream ins) throws IOException
+ {
+ try
+ {
+ byte[] bytes = new byte[1024];
+ int r = ins.read(bytes);
+ while (r > 0)
+ {
+ outs.write(bytes, 0, r);
+ r = ins.read(bytes);
+ }
+ }
+ catch (IOException e)
+ {
+ throw e;
+ }
+ finally{
+ ins.close();
+ }
+ }
}
13 years