JBossWS SVN: r18247 - container/jboss72/branches/jbossws-jboss720.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-01-16 09:47:41 -0500 (Thu, 16 Jan 2014)
New Revision: 18247
Modified:
container/jboss72/branches/jbossws-jboss720/pom.xml
Log:
Updating component dependencies
Modified: container/jboss72/branches/jbossws-jboss720/pom.xml
===================================================================
--- container/jboss72/branches/jbossws-jboss720/pom.xml 2014-01-16 14:46:45 UTC (rev 18246)
+++ container/jboss72/branches/jbossws-jboss720/pom.xml 2014-01-16 14:47:41 UTC (rev 18247)
@@ -51,8 +51,8 @@
<properties>
<jbossws.api.version>1.0.2.Final</jbossws.api.version>
- <jbossws.spi.version>2.2.2.Final</jbossws.spi.version>
- <jbossws.common.version>2.2.3.Final</jbossws.common.version>
+ <jbossws.spi.version>2.3.0-SNAPSHOT</jbossws.spi.version>
+ <jbossws.common.version>2.3.0-SNAPSHOT</jbossws.common.version>
<jboss.msc.version>1.0.4.GA</jboss.msc.version>
<jboss.version>7.2.0.Final</jboss.version>
<jboss.jaxws.api.version>2.0.2.Final</jboss.jaxws.api.version>
10 years, 11 months
JBossWS SVN: r18246 - in common/trunk/src/main/java/org/jboss/ws/common: management and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-01-16 09:46:45 -0500 (Thu, 16 Jan 2014)
New Revision: 18246
Added:
common/trunk/src/main/java/org/jboss/ws/common/management/CommonConfigStoreImpl.java
Modified:
common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
Log:
[JBWS-3739][JBWS-3708][JBWS-3707][JBWS-3689] svn merge -r 18113:18144 https://svn.jboss.org/repos/jbossws/stack/cxf/branches/JBWS-3739 .
Modified: common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2014-01-16 14:45:03 UTC (rev 18245)
+++ common/trunk/src/main/java/org/jboss/ws/common/configuration/ConfigHelper.java 2014-01-16 14:46:45 UTC (rev 18246)
@@ -113,11 +113,9 @@
} else {
ServerConfig sc = getServerConfig();
if (sc != null) {
- for (ClientConfig config : sc.getClientConfigs()) {
- if (config.getConfigName().equals(configName))
- {
- return config;
- }
+ ClientConfig cf = sc.getClientConfig(configName);
+ if (cf != null) {
+ return cf;
}
}
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2014-01-16 14:45:03 UTC (rev 18245)
+++ common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2014-01-16 14:46:45 UTC (rev 18246)
@@ -26,8 +26,6 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
import javax.management.MBeanServer;
@@ -35,6 +33,7 @@
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.WSFException;
import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.management.CommonConfigStore;
import org.jboss.wsf.spi.management.ServerConfig;
import org.jboss.wsf.spi.management.ServerConfigFactory;
import org.jboss.wsf.spi.management.StackConfig;
@@ -81,11 +80,10 @@
//The stack config
protected volatile StackConfig stackConfig;
- // The default endpoint configs, if any
- private final List<ClientConfig> clientConfigs = new CopyOnWriteArrayList<ClientConfig>();
- // The default endpoint configs, if any
- private final List<EndpointConfig> endpointConfigs = new CopyOnWriteArrayList<EndpointConfig>();
+ protected final CommonConfigStore<ClientConfig> clientConfigStore = new CommonConfigStoreImpl<ClientConfig>();
+ protected final CommonConfigStore<EndpointConfig> endpointConfigStore = new CommonConfigStoreImpl<EndpointConfig>();
+
// The server integration classloader' ServerConfig instance reference
private static ServerConfig serverConfig;
@@ -269,6 +267,9 @@
mbeanServer.registerMBean(this, AbstractServerConfigMBean.OBJECT_NAME);
}
+ clientConfigStore.reload();
+ endpointConfigStore.reload();
+
//cleanup the server integration classloader' service config reference as
//a new server config can be created due to a server reload.
synchronized (AbstractServerConfig.class) //synchronization to ensure visibility
@@ -283,6 +284,9 @@
if (mbeanServer != null) {
mbeanServer.unregisterMBean(AbstractServerConfigMBean.OBJECT_NAME);
}
+
+ clientConfigStore.unload();
+ endpointConfigStore.unload();
}
public static ServerConfig getServerIntegrationServerConfig()
@@ -307,27 +311,47 @@
{
return stackConfig.getImplementationVersion();
}
-
- public void addEndpointConfig(EndpointConfig config)
+
+ public void registerClientConfig(ClientConfig config)
{
- this.endpointConfigs.add(config);
+ clientConfigStore.register(config);
}
-
- public void addClientConfig(ClientConfig config)
+
+ public void unregisterClientConfig(ClientConfig config)
{
- this.clientConfigs.add(config);
+ clientConfigStore.unregister(config);
}
-
- public List<EndpointConfig> getEndpointConfigs()
+
+ public void reloadClientConfigs()
{
- return this.endpointConfigs;
+ clientConfigStore.reload();
}
-
- public List<ClientConfig> getClientConfigs()
+
+ public ClientConfig getClientConfig(String name)
{
- return this.clientConfigs;
+ return clientConfigStore.getConfig(name);
}
+ public void registerEndpointConfig(EndpointConfig config)
+ {
+ endpointConfigStore.register(config);
+ }
+
+ public void unregisterEndpointConfig(EndpointConfig config)
+ {
+ endpointConfigStore.unregister(config);
+ }
+
+ public void reloadEndpointConfigs()
+ {
+ endpointConfigStore.reload();
+ }
+
+ public EndpointConfig getEndpointConfig(String name)
+ {
+ return endpointConfigStore.getConfig(name);
+ }
+
public interface UpdateCallbackHandler {
public void onBeforeUpdate();
}
Copied: common/trunk/src/main/java/org/jboss/ws/common/management/CommonConfigStoreImpl.java (from rev 18129, common/branches/JBWS-3739/src/main/java/org/jboss/ws/common/management/CommonConfigStoreImpl.java)
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/management/CommonConfigStoreImpl.java (rev 0)
+++ common/trunk/src/main/java/org/jboss/ws/common/management/CommonConfigStoreImpl.java 2014-01-16 14:46:45 UTC (rev 18246)
@@ -0,0 +1,118 @@
+/*
+ * 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.common.management;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jboss.wsf.spi.management.CommonConfigStore;
+import org.jboss.wsf.spi.metadata.config.AbstractCommonConfig;
+
+
+/**
+ * A implementation of the CommonConfigStore based on HashMap;
+ * configs are stored using their name as key.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 04-Dec-2013
+ */
+public class CommonConfigStoreImpl<T extends AbstractCommonConfig> implements CommonConfigStore<T>
+{
+ private final Map<String, T> configs = new HashMap<String, T>(4);
+ private volatile T wrapper;
+ private volatile Map<String, T> loadedConfigs = Collections.emptyMap();
+
+ @Override
+ public synchronized void register(T config)
+ {
+ configs.put(config.getConfigName(), config);
+ }
+
+ @Override
+ public synchronized void unregister(T config)
+ {
+ configs.remove(config.getConfigName());
+ }
+
+ @SuppressWarnings("unchecked")
+ private T newInstance(T obj, T wrapper) {
+ Class<?> clazz = obj.getClass();
+ try {
+ return (T)clazz.getConstructor(clazz, wrapper.getClass()).newInstance(obj, wrapper);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public synchronized void reload()
+ {
+ Map<String, T> map = new HashMap<String, T>(configs.size(), 1);
+ if (wrapper != null) {
+ for (Entry<String, T> e : configs.entrySet()) {
+ map.put(e.getKey(), newInstance(e.getValue(), wrapper));
+ }
+ } else {
+ for (Entry<String, T> e : configs.entrySet()) {
+ map.put(e.getKey(), e.getValue());
+ }
+ }
+ this.loadedConfigs = Collections.unmodifiableMap(map);
+ }
+
+ @Override
+ public synchronized void unload()
+ {
+ this.loadedConfigs = Collections.emptyMap();
+ }
+
+ @Override
+ public synchronized void setWrapperConfig(T config, boolean reload)
+ {
+ this.wrapper = config;
+ if (reload) {
+ reload();
+ }
+ }
+
+ @Override
+ public synchronized T getWrapperConfig()
+ {
+ return this.wrapper;
+ }
+
+ @Override
+ public T getConfig(String name)
+ {
+ return this.loadedConfigs.get(name);
+ }
+
+ @Override
+ public Collection<T> getConfigs()
+ {
+ return this.loadedConfigs.values();
+ }
+
+}
10 years, 11 months
JBossWS SVN: r18245 - in spi/trunk/src: main/java/org/jboss/wsf/spi/metadata and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-01-16 09:45:03 -0500 (Thu, 16 Jan 2014)
New Revision: 18245
Added:
spi/trunk/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/management/ServerConfig.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ClientConfig.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/CommonConfig.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ConfigMetaDataParser.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/EndpointConfig.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointsMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossPortComponentMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebserviceDescriptionMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.java
spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/config/ConfigMDParserTestCase.java
Log:
[JBWS-3739][JBWS-3708][JBWS-3707][JBWS-3689] svn merge -r 18105:18141 https://svn.jboss.org/repos/jbossws/spi/branches/JBWS-3739 .
Copied: spi/trunk/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java (from rev 18141, spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java)
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java (rev 0)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, 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.wsf.spi.management;
+
+import java.util.Collection;
+
+import org.jboss.wsf.spi.metadata.config.AbstractCommonConfig;
+
+
+/**
+ * A store of client/endpoint config
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 04-Dec-2013
+ */
+public interface CommonConfigStore<T extends AbstractCommonConfig>
+{
+ /**
+ * Registers a config in the store; the new config will affect runtime the first time the store is reloaded.
+ *
+ * @param config
+ */
+ void register(T config);
+
+ /**
+ * Unregisters a config in the store; the runtime will be affected the first time the store is reloaded.
+ *
+ * @param config
+ */
+ void unregister(T config);
+
+ /**
+ * Reloads the store, which involves iterating over the registered configs and creating a collection that is
+ * returned when calling getConfig(..) / getConfigs().
+ */
+ void reload();
+
+ /**
+ * Unloads the store, cleaning up the loaded collection.
+ */
+ void unload();
+
+ /**
+ * Sets a wrapper config, to be merged with any registered config.
+ *
+ * @param config
+ * @param reload Whether to reload the store after having set the wrapper or not
+ */
+ void setWrapperConfig(T config, boolean reload);
+
+ /**
+ * Returns current wrapper config
+ *
+ * @return
+ */
+ T getWrapperConfig();
+
+ /**
+ * Retrieves a config by name from the loaded collection
+ *
+ * @param name
+ * @return
+ */
+ T getConfig(String name);
+
+ /**
+ * Returns the loaded config collection
+ *
+ * @return
+ */
+ Collection<T> getConfigs();
+}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/management/ServerConfig.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/management/ServerConfig.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/management/ServerConfig.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -23,7 +23,6 @@
import java.io.File;
import java.net.UnknownHostException;
-import java.util.List;
import org.jboss.wsf.spi.metadata.config.ClientConfig;
import org.jboss.wsf.spi.metadata.config.EndpointConfig;
@@ -66,11 +65,59 @@
void setModifySOAPAddress(boolean flag);
- void addEndpointConfig(EndpointConfig config);
+ /**
+ * Register a client config in the server configuration; the new config will apply to runtime when the server config is started
+ * or after a client config store reload.
+ *
+ * @param config
+ */
+ void registerClientConfig(ClientConfig config);
- List<EndpointConfig> getEndpointConfigs();
+ /**
+ * Unregister a client config from the server configuration; the new config will be removed from
+ * the collection returned to callers after next endpoint store reload.
+ *
+ * @param config
+ */
+ void unregisterClientConfig(ClientConfig config);
- void addClientConfig(ClientConfig config);
+ /**
+ * Reloads the client config store
+ */
+ void reloadClientConfigs();
- List<ClientConfig> getClientConfigs();
+ /**
+ * Get a client config by name
+ *
+ * @return
+ */
+ ClientConfig getClientConfig(String name);
+
+ /**
+ * Register an endpoint config in the server configuration; the new config will apply to runtime when the server config is started
+ * or after an endpoint config store reload.
+ *
+ * @param config
+ */
+ void registerEndpointConfig(EndpointConfig config);
+
+ /**
+ * Unregister an endpoint config from the server configuration; the new config will be removed from
+ * the collection returned to callers after next endpoint store reload.
+ *
+ * @param config
+ */
+ void unregisterEndpointConfig(EndpointConfig config);
+
+ /**
+ * Reloads the endpoint config store
+ */
+ void reloadEndpointConfigs();
+
+ /**
+ * Get an endpoint config by name
+ *
+ * @return
+ */
+ EndpointConfig getEndpointConfig(String name);
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/AbstractHandlerChainsMetaDataParser.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -39,6 +39,13 @@
import static org.jboss.wsf.spi.util.StAXUtils.elementAsString;
import static org.jboss.wsf.spi.util.StAXUtils.match;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -64,7 +71,7 @@
protected UnifiedHandlerChainsMetaData parseHandlerChains(XMLStreamReader reader, String nsUri,
String handlerChainsElementNS, String handlerChainsElementName) throws XMLStreamException
{
- UnifiedHandlerChainsMetaData handlerChains = new UnifiedHandlerChainsMetaData();
+ List<UnifiedHandlerChainMetaData> handlerChains = new ArrayList<UnifiedHandlerChainMetaData>(1);
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -72,7 +79,7 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, handlerChainsElementNS, handlerChainsElementName))
{
- return handlerChains;
+ return new UnifiedHandlerChainsMetaData(handlerChains);
}
else
{
@@ -81,7 +88,7 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, HANDLER_CHAIN)) {
- handlerChains.addHandlerChain(parseHandlerChain(reader, nsUri));
+ handlerChains.add(parseHandlerChain(reader, nsUri));
}
else
{
@@ -95,7 +102,10 @@
private UnifiedHandlerChainMetaData parseHandlerChain(XMLStreamReader reader, String nsUri) throws XMLStreamException
{
- UnifiedHandlerChainMetaData handlerChain = new UnifiedHandlerChainMetaData();
+ QName portNamePattern = null;
+ QName serviceNamePattern = null;
+ String protocolBindings = null;
+ List<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>(4);
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -103,7 +113,7 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, nsUri, HANDLER_CHAIN))
{
- return handlerChain;
+ return new UnifiedHandlerChainMetaData(serviceNamePattern, portNamePattern, protocolBindings, handlers, false, null);
}
else
{
@@ -113,18 +123,18 @@
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, CHAIN_PORT_PATTERN))
{
- handlerChain.setPortNamePattern(elementAsQName(reader));
+ portNamePattern = elementAsQName(reader);
}
else if (match(reader, nsUri, CHAIN_SERVICE_PATTERN))
{
- handlerChain.setServiceNamePattern(elementAsQName(reader));
+ serviceNamePattern = elementAsQName(reader);
}
else if(match(reader, nsUri, CHAIN_PROTOCOL_BINDING))
{
- handlerChain.setProtocolBindings(elementAsString(reader));
+ protocolBindings = elementAsString(reader);
}
else if (match(reader, nsUri, HANDLER)) {
- handlerChain.addHandler(parseHandler(reader, nsUri, handlerChain));
+ handlers.add(parseHandler(reader, nsUri));
}
else
{
@@ -138,12 +148,12 @@
protected UnifiedHandlerMetaData parseHandler(XMLStreamReader reader, String nsUri) throws XMLStreamException
{
- return parseHandler(reader, nsUri, null);
- }
-
- private UnifiedHandlerMetaData parseHandler(XMLStreamReader reader, String nsUri, UnifiedHandlerChainMetaData handlerChain) throws XMLStreamException
- {
- UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData(handlerChain);
+ String handlerName = null;
+ String handlerClass = null;
+ List<UnifiedInitParamMetaData> initParams = new LinkedList<UnifiedInitParamMetaData>();
+ Set<QName> soapHeaders = new HashSet<QName>(2);
+ Set<String> soapRoles = new HashSet<String>(2);
+ Set<String> portNames = new HashSet<String>(4);
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -151,7 +161,7 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, nsUri, HANDLER))
{
- return handler;
+ return new UnifiedHandlerMetaData(handlerClass, handlerName, initParams, soapHeaders, soapRoles, portNames);
}
else
{
@@ -161,20 +171,20 @@
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, HANDLER_NAME))
{
- handler.setHandlerName(elementAsString(reader));
+ handlerName = elementAsString(reader);
}
else if (match(reader, nsUri, HANDLER_CLASS))
{
- handler.setHandlerClass(elementAsString(reader));
+ handlerClass = elementAsString(reader);
}
else if (match(reader, nsUri, HANDLER_PARAM)) {
- handler.addInitParam(parseInitParam(reader, nsUri));
+ initParams.add(parseInitParam(reader, nsUri));
}
else if (match(reader, nsUri, HANDLER_SOAP_ROLE)) {
- handler.addSoapRole(elementAsString(reader));
+ soapRoles.add(elementAsString(reader));
}
else if (match(reader, nsUri, HANDLER_SOAP_HEADER)) {
- handler.addSoapHeader(elementAsQName(reader));
+ soapHeaders.add(elementAsQName(reader));
}
else
{
@@ -188,7 +198,8 @@
private UnifiedInitParamMetaData parseInitParam(XMLStreamReader reader, String nsUri) throws XMLStreamException
{
- UnifiedInitParamMetaData initParam = new UnifiedInitParamMetaData();
+ String paramName = null;
+ String paramValue = null;
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -196,7 +207,7 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, nsUri, HANDLER_PARAM))
{
- return initParam;
+ return new UnifiedInitParamMetaData(paramName, paramValue);
}
else
{
@@ -206,11 +217,11 @@
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, HANDLER_PARAM_NAME))
{
- initParam.setParamName(elementAsString(reader));
+ paramName = elementAsString(reader);
}
else if (match(reader, nsUri, HANDLER_PARAM_VALUE))
{
- initParam.setParamValue(elementAsString(reader));
+ paramValue = elementAsString(reader);
}
else
{
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -21,6 +21,8 @@
*/
package org.jboss.wsf.spi.metadata.config;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -37,32 +39,130 @@
*/
public abstract class AbstractCommonConfig implements CommonConfig
{
- private String configName;
- private Map<String, Feature> features = new HashMap<String, Feature>(2);
- private Map<String, String> properties = new HashMap<String, String>(4);
- private List<UnifiedHandlerChainMetaData> preHandlerChains;
- private List<UnifiedHandlerChainMetaData> postHandlerChains;
+ private final String configName;
+ private final Map<String, Feature> features;
+ private final Map<String, String> properties;
+ private final List<UnifiedHandlerChainMetaData> preHandlerChains;
+ private final List<UnifiedHandlerChainMetaData> postHandlerChains;
+
+ protected AbstractCommonConfig(String configName,
+ List<UnifiedHandlerChainMetaData> preHandlerChains,
+ List<UnifiedHandlerChainMetaData> postHandlerChains,
+ Map<String, String> properties,
+ Map<String, Feature> features)
+ {
+ super();
+ this.configName = configName;
+ if (features != null && !features.isEmpty()) {
+ this.features = Collections.unmodifiableMap(features);
+ } else {
+ this.features = Collections.emptyMap();
+ }
+ if (properties != null && !properties.isEmpty()) {
+ this.properties = Collections.unmodifiableMap(properties);
+ } else {
+ this.properties = Collections.emptyMap();
+ }
+ if (preHandlerChains != null && !preHandlerChains.isEmpty()) {
+ this.preHandlerChains = Collections.unmodifiableList(preHandlerChains);
+ } else {
+ this.preHandlerChains = Collections.emptyList();
+ }
+ if (postHandlerChains != null && !postHandlerChains.isEmpty()) {
+ this.postHandlerChains = Collections.unmodifiableList(postHandlerChains);
+ } else {
+ this.postHandlerChains = Collections.emptyList();
+ }
+ }
+
+ protected AbstractCommonConfig(AbstractCommonConfig base, AbstractCommonConfig addon)
+ {
+ super();
+ this.configName = base.getConfigName();
+ if (addon.features != null && !addon.features.isEmpty())
+ {
+ Map<String, Feature> map;
+ if (base.features.isEmpty())
+ {
+ map = addon.features;
+ }
+ else
+ {
+ map = new HashMap<String, Feature>(base.features);
+ map.putAll(addon.features);
+ }
+ this.features = Collections.unmodifiableMap(map);
+ }
+ else
+ {
+ this.features = Collections.emptyMap();
+ }
+ if (addon.properties != null && !addon.properties.isEmpty())
+ {
+ Map<String, String> map;
+ if (base.properties.isEmpty())
+ {
+ map = addon.properties;
+ }
+ else
+ {
+ map = new HashMap<String, String>(base.properties);
+ map.putAll(addon.properties);
+ }
+ this.properties = Collections.unmodifiableMap(map);
+ }
+ else
+ {
+ this.properties = Collections.emptyMap();
+ }
+ if (addon.preHandlerChains != null && !addon.preHandlerChains.isEmpty())
+ {
+ List<UnifiedHandlerChainMetaData> list;
+ if (base.preHandlerChains.isEmpty())
+ {
+ list = addon.preHandlerChains;
+ }
+ else
+ {
+ list = new ArrayList<UnifiedHandlerChainMetaData>(base.preHandlerChains);
+ list.addAll(addon.preHandlerChains);
+ }
+ this.preHandlerChains = Collections.unmodifiableList(list);
+ }
+ else
+ {
+ this.preHandlerChains = Collections.emptyList();
+ }
+ if (addon.postHandlerChains != null && !addon.postHandlerChains.isEmpty())
+ {
+ List<UnifiedHandlerChainMetaData> list;
+ if (base.postHandlerChains.isEmpty())
+ {
+ list = addon.postHandlerChains;
+ }
+ else
+ {
+ list = new ArrayList<UnifiedHandlerChainMetaData>(base.postHandlerChains);
+ list.addAll(preHandlerChains);
+ }
+ this.postHandlerChains = Collections.unmodifiableList(list);
+ }
+ else
+ {
+ this.postHandlerChains = Collections.emptyList();
+ }
+ }
public List<UnifiedHandlerChainMetaData> getPostHandlerChains()
{
return postHandlerChains;
}
- public void setPostHandlerChains(List<UnifiedHandlerChainMetaData> postHandlerChain)
- {
- this.postHandlerChains = postHandlerChain;
- }
-
public List<UnifiedHandlerChainMetaData> getPreHandlerChains()
{
return preHandlerChains;
}
- public void setPreHandlerChains(List<UnifiedHandlerChainMetaData> preHandlerChains)
- {
- this.preHandlerChains = preHandlerChains;
- }
-
public List<UnifiedHandlerChainMetaData> getHandlers(HandlerType type)
{
List<UnifiedHandlerChainMetaData> handlerChains;
@@ -79,30 +179,11 @@
return configName;
}
- public void setConfigName(String configName)
- {
- this.configName = configName;
- }
-
public boolean hasFeature(String name)
{
return features.containsKey(name);
}
- public void setFeature(Feature feature, boolean enabled) {
-
- if(enabled) {
- features.put(feature.getName(), feature);
- }
- else
- features.remove(feature.getName());
- }
-
- public void setProperty(String name, String value)
- {
- properties.put(name, value);
- }
-
public String getProperty(String name)
{
return properties.get(name);
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ClientConfig.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ClientConfig.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ClientConfig.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -21,6 +21,11 @@
*/
package org.jboss.wsf.spi.metadata.config;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+
/**
* A JBossWS client configuration
*
@@ -30,4 +35,15 @@
public class ClientConfig extends AbstractCommonConfig
{
public static final String STANDARD_CLIENT_CONFIG = "Standard-Client-Config";
+
+ public ClientConfig(String configName, List<UnifiedHandlerChainMetaData> preHandlerChains,
+ List<UnifiedHandlerChainMetaData> postHandlerChains, Map<String, String> properties,
+ Map<String, Feature> features)
+ {
+ super(configName, preHandlerChains, postHandlerChains, properties, features);
+ }
+
+ public ClientConfig(ClientConfig base, ClientConfig addon) {
+ super(base, addon);
+ }
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/CommonConfig.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/CommonConfig.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/CommonConfig.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -40,24 +40,14 @@
public List<UnifiedHandlerChainMetaData> getPostHandlerChains();
- public void setPostHandlerChains(List<UnifiedHandlerChainMetaData> postHandlerChain);
-
public List<UnifiedHandlerChainMetaData> getPreHandlerChains();
- public void setPreHandlerChains(List<UnifiedHandlerChainMetaData> preHandlerChains);
-
public List<UnifiedHandlerChainMetaData> getHandlers(HandlerType type);
public String getConfigName();
- public void setConfigName(String configName);
-
public boolean hasFeature(String name);
- public void setFeature(Feature feature, boolean enabled);
-
- public void setProperty(String name, String value);
-
public String getProperty(String name);
public Map<String, String> getProperties();
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ConfigMetaDataParser.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ConfigMetaDataParser.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/ConfigMetaDataParser.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -44,6 +44,10 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
@@ -52,6 +56,7 @@
import org.jboss.wsf.spi.Loggers;
import org.jboss.wsf.spi.metadata.AbstractHandlerChainsMetaDataParser;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.wsf.spi.util.StAXUtils;
@@ -153,14 +158,10 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, JBOSSWS_JAXWS_CONFIG_NS_4_0, ENDPOINT_CONFIG)) {
- EndpointConfig epConfig = new EndpointConfig();
- parseConfig(reader, epConfig, ENDPOINT_CONFIG);
- configRoot.addEndpointConfig(epConfig);
+ configRoot.addEndpointConfig(parseEndpointConfig(reader));
}
else if (match(reader, JBOSSWS_JAXWS_CONFIG_NS_4_0, CLIENT_CONFIG)) {
- ClientConfig clConfig = new ClientConfig();
- parseConfig(reader, clConfig, CLIENT_CONFIG);
- configRoot.addClientConfig(clConfig);
+ configRoot.addClientConfig(parseClientConfig(reader));
}
else
{
@@ -172,8 +173,23 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
- private void parseConfig(XMLStreamReader reader, CommonConfig config, String configElement) throws XMLStreamException
+ private EndpointConfig parseEndpointConfig(final XMLStreamReader reader) throws XMLStreamException
{
+ return (EndpointConfig)parseConfig(reader, ENDPOINT_CONFIG);
+ }
+
+ private ClientConfig parseClientConfig(final XMLStreamReader reader) throws XMLStreamException
+ {
+ return (ClientConfig)parseConfig(reader, CLIENT_CONFIG);
+ }
+
+ private CommonConfig parseConfig(final XMLStreamReader reader, final String configElement) throws XMLStreamException
+ {
+ String configName = null;
+ List<UnifiedHandlerChainMetaData> pre = null;
+ List<UnifiedHandlerChainMetaData> post = null;
+ List<Feature> features = new ArrayList<Feature>(1);
+ List<Prop> properties = new ArrayList<Prop>(1);
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -181,7 +197,24 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, JBOSSWS_JAXWS_CONFIG_NS_4_0, configElement))
{
- return;
+ Map<String, String> props = null;
+ if (!properties.isEmpty()) {
+ props = new HashMap<String, String>(properties.size(), 1);
+ for (Prop ps : properties)
+ {
+ props.put(ps.getName(), ps.getValue());
+ }
+ }
+ Map<String, Feature> featuresMap = null;
+ if (!features.isEmpty()) {
+ featuresMap = new HashMap<String, Feature>(features.size(), 1);
+ for (Feature f : features)
+ {
+ featuresMap.put(f.getName(), f);
+ }
+ }
+ return CLIENT_CONFIG.equals(configElement) ? new ClientConfig(configName, pre, post, props,
+ featuresMap) : new EndpointConfig(configName, pre, post, props, featuresMap);
}
else
{
@@ -190,21 +223,21 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, JBOSSWS_JAXWS_CONFIG_NS_4_0, CONFIG_NAME)) {
- config.setConfigName(elementAsString(reader));
+ configName = elementAsString(reader);
}
else if (match(reader, JBOSSWS_JAXWS_CONFIG_NS_4_0, PRE_HANDLER_CHAINS)) {
UnifiedHandlerChainsMetaData uhcmd = parseHandlerChains(reader, JAVAEE_NS, JBOSSWS_JAXWS_CONFIG_NS_4_0, PRE_HANDLER_CHAINS);
- config.setPreHandlerChains(uhcmd.getHandlerChains());
+ pre = uhcmd.getHandlerChains();
}
else if (match(reader, JBOSSWS_JAXWS_CONFIG_NS_4_0, POST_HANDLER_CHAINS)) {
UnifiedHandlerChainsMetaData uhcmd = parseHandlerChains(reader, JAVAEE_NS, JBOSSWS_JAXWS_CONFIG_NS_4_0, POST_HANDLER_CHAINS);
- config.setPostHandlerChains(uhcmd.getHandlerChains());
+ post = uhcmd.getHandlerChains();
}
else if (match(reader, JBOSSWS_JAXWS_CONFIG_NS_4_0, FEATURE)) {
- config.setFeature(parseFeature(reader), true);
+ features.add(parseFeature(reader));
}
else if (match(reader, JBOSSWS_JAXWS_CONFIG_NS_4_0, PROPERTY)) {
- parseProperty(reader, config);
+ properties.add(parseProperty(reader));
}
else
{
@@ -216,7 +249,7 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
- private void parseProperty(XMLStreamReader reader, CommonConfig config) throws XMLStreamException
+ private Prop parseProperty(XMLStreamReader reader) throws XMLStreamException
{
String name = null;
String value = null;
@@ -231,8 +264,7 @@
{
throw MESSAGES.couldNotGetPropertyName(getDescriptorForLogs());
}
- config.setProperty(name, value);
- return;
+ return new Prop(name, value);
}
else
{
@@ -256,6 +288,28 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
+ private class Prop {
+ private final String name;
+ private final String value;
+
+ public Prop(String name, String value)
+ {
+ super();
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+ }
+
private Feature parseFeature(XMLStreamReader reader) throws XMLStreamException
{
Feature feature = null;
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/EndpointConfig.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/EndpointConfig.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/config/EndpointConfig.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -21,6 +21,11 @@
*/
package org.jboss.wsf.spi.metadata.config;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+
/**
* A JBossWS endpoint configuration
*
@@ -30,4 +35,15 @@
public class EndpointConfig extends AbstractCommonConfig
{
public static final String STANDARD_ENDPOINT_CONFIG = "Standard-Endpoint-Config";
+
+ public EndpointConfig(String configName, List<UnifiedHandlerChainMetaData> preHandlerChains,
+ List<UnifiedHandlerChainMetaData> postHandlerChains, Map<String, String> properties,
+ Map<String, Feature> features)
+ {
+ super(configName, preHandlerChains, postHandlerChains, properties, features);
+ }
+
+ public EndpointConfig(EndpointConfig base, EndpointConfig conf) {
+ super(base, conf);
+ }
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -22,27 +22,47 @@
package org.jboss.wsf.spi.metadata.j2ee.serviceref;
import java.io.Serializable;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.xml.namespace.QName;
/** The unified metadata data for a handler chain element
- *
+ *
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
*/
public class UnifiedHandlerChainMetaData implements Serializable
{
- private static final long serialVersionUID = 1L;
- private QName serviceNamePattern;
- private QName portNamePattern;
- private String protocolBindings;
- private List<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>(4);
- private boolean excluded;
- private String id;
+ private static final long serialVersionUID = 4612021639718764949L;
+
+ private final QName serviceNamePattern;
+ private final QName portNamePattern;
+ private final String protocolBindings;
+ private final List<UnifiedHandlerMetaData> handlers;
+ private final boolean excluded;
+ private final String id;
- public UnifiedHandlerChainMetaData()
+ public UnifiedHandlerChainMetaData(QName serviceNamePattern,
+ QName portNamePattern,
+ String protocolBindings,
+ List<UnifiedHandlerMetaData> handlers,
+ boolean excluded,
+ String id)
{
+ this.serviceNamePattern = serviceNamePattern;
+ this.portNamePattern = portNamePattern;
+ this.protocolBindings = protocolBindings;
+ this.excluded = excluded;
+ this.id = id;
+ if (handlers != null && !handlers.isEmpty()) {
+ this.handlers = Collections.unmodifiableList(handlers);
+ for (UnifiedHandlerMetaData uhmd : handlers) {
+ uhmd.setHandlerChain(this);
+ }
+ } else {
+ this.handlers = Collections.emptyList();
+ }
}
public String getId()
@@ -50,56 +70,27 @@
return id;
}
- public void setId(final String id)
- {
- this.id = id;
- }
-
public QName getPortNamePattern()
{
return portNamePattern;
}
- public void setPortNamePattern(QName portNamePattern)
- {
- this.portNamePattern = portNamePattern;
- }
-
public QName getServiceNamePattern()
{
return serviceNamePattern;
}
- public void setServiceNamePattern(QName serviceNamePattern)
- {
- this.serviceNamePattern = serviceNamePattern;
- }
-
public String getProtocolBindings()
{
return protocolBindings;
}
- public void setProtocolBindings(String protocolBindings)
- {
- this.protocolBindings = protocolBindings;
- }
-
public List<UnifiedHandlerMetaData> getHandlers()
{
return handlers;
}
- public void addHandler(UnifiedHandlerMetaData handler)
- {
- handlers.add(handler);
- }
-
public boolean isExcluded() {
return this.excluded;
}
-
- public void setExcluded(boolean excluded) {
- this.excluded = excluded;
- }
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -22,30 +22,37 @@
package org.jboss.wsf.spi.metadata.j2ee.serviceref;
import java.io.Serializable;
-import java.util.LinkedList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
/** The unified metadata data for a handler chains element
*
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
*/
public class UnifiedHandlerChainsMetaData implements Serializable
{
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -4983482217732535558L;
+
+ private final List<UnifiedHandlerChainMetaData> handlerChains;
+
+ public UnifiedHandlerChainsMetaData(UnifiedHandlerChainMetaData... handlerChains)
+ {
+ this(handlerChains != null ? Arrays.asList(handlerChains) : null);
+ }
- private List<UnifiedHandlerChainMetaData> handlerChains = new LinkedList<UnifiedHandlerChainMetaData>();
-
- public UnifiedHandlerChainsMetaData()
+ public UnifiedHandlerChainsMetaData(List<UnifiedHandlerChainMetaData> handlerChains)
{
+ if (handlerChains != null && !handlerChains.isEmpty()) {
+ this.handlerChains = Collections.unmodifiableList(handlerChains);
+ } else {
+ this.handlerChains = Collections.emptyList();
+ }
}
public List<UnifiedHandlerChainMetaData> getHandlerChains()
{
return handlerChains;
}
-
- public void addHandlerChain(UnifiedHandlerChainMetaData handlerChain)
- {
- handlerChains.add(handlerChain);
- }
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedHandlerMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -22,8 +22,7 @@
package org.jboss.wsf.spi.metadata.j2ee.serviceref;
import java.io.Serializable;
-import java.util.HashSet;
-import java.util.LinkedList;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -33,48 +32,66 @@
* The unified metadata data for a handler element
*
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
*/
public class UnifiedHandlerMetaData implements Serializable
{
- private static final long serialVersionUID = 1L;
-
+ private static final long serialVersionUID = 1042008569778083467L;
+
public enum HandlerType
{
PRE, ENDPOINT, POST, ALL
}
- private UnifiedHandlerChainMetaData handlerChain;
+ private volatile UnifiedHandlerChainMetaData handlerChain;
// The required <handler-name> element
- private String handlerName;
+ private final String handlerName;
// The required <handler-class> element
- private String handlerClass;
+ private final String handlerClass;
// The optional <init-param> elements
- private List<UnifiedInitParamMetaData> initParams = new LinkedList<UnifiedInitParamMetaData>();
+ private final List<UnifiedInitParamMetaData> initParams;
// The optional <soap-header> elements
- private Set<QName> soapHeaders = new HashSet<QName>(2);
+ private final Set<QName> soapHeaders;
// The optional <soap-role> elements
- private Set<String> soapRoles = new HashSet<String>(2);
+ private final Set<String> soapRoles;
// The optional <port-name> elements, these only apply to webservice clients
- private Set<String> portNames = new HashSet<String>(4);
+ private final Set<String> portNames;
- public UnifiedHandlerMetaData(UnifiedHandlerChainMetaData handlerChain)
- {
- this.handlerChain = handlerChain;
+ public UnifiedHandlerMetaData(String handlerClass,
+ String handlerName,
+ List<UnifiedInitParamMetaData> initParams,
+ Set<QName> soapHeaders,
+ Set<String> soapRoles,
+ Set<String> portNames) {
+ this.handlerClass = handlerClass;
+ this.handlerName = handlerName;
+ this.initParams = initParams != null ? Collections.unmodifiableList(initParams) : null;
+ if (soapHeaders != null && !soapHeaders.isEmpty()) {
+ this.soapHeaders = Collections.unmodifiableSet(soapHeaders);
+ } else {
+ this.soapHeaders = Collections.emptySet();
+ }
+ if (soapRoles != null && !soapRoles.isEmpty()) {
+ this.soapRoles = Collections.unmodifiableSet(soapRoles);
+ } else {
+ this.soapRoles = Collections.emptySet();
+ }
+ if (portNames != null && !portNames.isEmpty()) {
+ this.portNames = Collections.unmodifiableSet(portNames);
+ } else {
+ this.portNames = Collections.emptySet();
+ }
}
- public UnifiedHandlerMetaData()
- {
- }
-
public UnifiedHandlerChainMetaData getHandlerChain()
{
return handlerChain;
}
-
- public void setHandlerName(String value)
+
+ protected void setHandlerChain(UnifiedHandlerChainMetaData handlerChain)
{
- this.handlerName = value;
+ this.handlerChain = handlerChain;
}
public String getHandlerName()
@@ -82,41 +99,21 @@
return handlerName;
}
- public void setHandlerClass(String handlerClass)
- {
- this.handlerClass = handlerClass;
- }
-
public String getHandlerClass()
{
return handlerClass;
}
- public void addInitParam(UnifiedInitParamMetaData param)
- {
- initParams.add(param);
- }
-
public List<UnifiedInitParamMetaData> getInitParams()
{
return initParams;
}
- public void addSoapHeader(QName qName)
- {
- soapHeaders.add(qName);
- }
-
public Set<QName> getSoapHeaders()
{
return soapHeaders;
}
- public void addSoapRole(String value)
- {
- soapRoles.add(value);
- }
-
public Set<String> getSoapRoles()
{
return soapRoles;
@@ -127,11 +124,6 @@
return portNames;
}
- public void addPortName(String value)
- {
- portNames.add(value);
- }
-
public String toString()
{
StringBuilder str = new StringBuilder();
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -25,15 +25,18 @@
/**
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
+ *
* @since 06-May-2004
*/
public class UnifiedInitParamMetaData implements Serializable
{
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2508971618066360091L;
+
// The required <param-name> element
- private String paramName;
+ private final String paramName;
// The required <param-value> element
- private String paramValue;
+ private final String paramValue;
public UnifiedInitParamMetaData(String paramName, String paramValue)
{
@@ -41,30 +44,16 @@
this.paramValue = paramValue;
}
- public UnifiedInitParamMetaData()
- {
- }
-
public String getParamName()
{
return paramName;
}
- public void setParamName(String paramName)
- {
- this.paramName = paramName;
- }
-
public String getParamValue()
{
return paramValue;
}
- public void setParamValue(String paramValue)
- {
- this.paramValue = paramValue;
- }
-
public String toString()
{
return "[name=" + paramName + ",value=" + paramValue + "]";
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -25,36 +25,33 @@
/**
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 06-May-2004
*/
public class UnifiedStubPropertyMetaData implements Serializable
{
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -4584869798181720949L;
// The required <prop-name> element
- private String propName;
+ private final String propName;
// The required <prop-value> element
- private String propValue;
+ private final String propValue;
+
+ public UnifiedStubPropertyMetaData(String propName, String propValue)
+ {
+ this.propName = propName;
+ this.propValue = propValue;
+ }
public String getPropName()
{
return propName;
}
- public void setPropName(String paramName)
- {
- this.propName = paramName;
- }
-
public String getPropValue()
{
return propValue;
}
- public void setPropValue(String paramValue)
- {
- this.propValue = paramValue;
- }
-
public String toString()
{
return "[name=" + propName + ",value=" + propValue + "]";
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -24,35 +24,43 @@
/**
* JMS Meta data class contains the implementor and address information
* @author <a href="ema(a)redhat.com">Jim Ma</a>
+ * @author <a href="alessio.soldano(a)jboss.com">Alessio Soldano</a>
*/
public class JMSEndpointMetaData
{
//Endpoint name
- private String name;
-
+ private final String name;
//port name
- private String endpointName = "";
-
+ private final String endpointName;
//implementor class
- private String implementor = "";
-
+ private final String implementor;
//wsdl location
- private String wsdlLocation = "";
-
- private String soapAddress = "";
-
+ private final String wsdlLocation;
+ private final String soapAddress;
//parent component
- private JMSEndpointsMetaData endpointsMetaData = null;
-
- public JMSEndpointMetaData(JMSEndpointsMetaData endpoints)
+ private volatile JMSEndpointsMetaData endpointsMetaData;
+
+ public JMSEndpointMetaData(String name, String endpointName, String implementor, String wsdlLocation,
+ String soapAddress)
{
- endpointsMetaData = endpoints;
+ this.name = name;
+ this.endpointName = endpointName;
+ this.implementor = implementor;
+ this.wsdlLocation = wsdlLocation;
+ this.soapAddress = soapAddress;
}
public JMSEndpointsMetaData getParentMetaData()
{
return endpointsMetaData;
}
+
+ public void setParentMetaData(JMSEndpointsMetaData endpointsMetaData) {
+ if (endpointsMetaData != null) {
+ throw new IllegalStateException();
+ }
+ this.endpointsMetaData = endpointsMetaData;
+ }
public String getImplementor()
{
@@ -74,34 +82,8 @@
return wsdlLocation;
}
- public void setImplementor(String implementor)
- {
- this.implementor = implementor;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public void setEndpointName(String endpointName)
- {
- this.endpointName = endpointName;
- }
-
- public void setWsdlLocation(String wsdlLocation)
- {
- this.wsdlLocation = wsdlLocation;
- }
-
public String getSoapAddress()
{
return soapAddress;
}
-
- public void setSoapAddress(String soapAddress)
- {
- this.soapAddress = soapAddress;
- }
-
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointsMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointsMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/jms/JMSEndpointsMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -21,22 +21,26 @@
*/
package org.jboss.wsf.spi.metadata.jms;
-import java.util.LinkedList;
+import java.util.Collections;
import java.util.List;
/**
* @author <a href="ema(a)redhat.com">Jim Ma</a>
+ * @author <a href="alessio.soldano(a)jboss.com">Alessio Soldano</a>
*/
public final class JMSEndpointsMetaData
{
-
- private List<JMSEndpointMetaData> jmsEndpointsMD = new LinkedList<JMSEndpointMetaData>();
-
- public void addEndpointMetaData(JMSEndpointMetaData endpointMetaData)
+ private final List<JMSEndpointMetaData> jmsEndpointsMD;
+
+ public JMSEndpointsMetaData(List<JMSEndpointMetaData> jmsEndpointsMD)
{
- jmsEndpointsMD.add(endpointMetaData);
+ if (jmsEndpointsMD != null && !jmsEndpointsMD.isEmpty()) {
+ this.jmsEndpointsMD = Collections.unmodifiableList(jmsEndpointsMD);
+ } else {
+ this.jmsEndpointsMD = Collections.emptyList();
+ }
}
-
+
public List<JMSEndpointMetaData> getEndpointsMetaData() {
return jmsEndpointsMD;
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossPortComponentMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossPortComponentMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossPortComponentMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
+ * Copyright 2013, 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.
*
@@ -24,60 +24,48 @@
/**
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
*/
public final class JBossPortComponentMetaData {
- private String ejbName;
- private String portComponentName;
- private String portComponentURI;
- private String authMethod;
- private String transportGuarantee;
- private Boolean secureWSDLAccess;
+ private final String ejbName;
+ private final String portComponentName;
+ private final String portComponentURI;
+ private final String authMethod;
+ private final String transportGuarantee;
+ private final Boolean secureWSDLAccess;
- public void setEjbName(String ejbName) {
- this.ejbName = ejbName;
- }
+ public JBossPortComponentMetaData(String ejbName, String portComponentName, String portComponentURI,
+ String authMethod, String transportGuarantee, Boolean secureWSDLAccess)
+ {
+ this.ejbName = ejbName;
+ this.portComponentName = portComponentName;
+ this.portComponentURI = portComponentURI;
+ this.authMethod = authMethod;
+ this.transportGuarantee = transportGuarantee;
+ this.secureWSDLAccess = secureWSDLAccess;
+ }
public String getEjbName() {
return ejbName;
}
- public void setPortComponentName(String portComponentName) {
- this.portComponentName = portComponentName;
- }
-
public String getPortComponentName() {
return portComponentName;
}
- public void setPortComponentURI(String portComponentURI) {
- this.portComponentURI = portComponentURI;
- }
-
public String getPortComponentURI() {
return portComponentURI;
}
- public void setAuthMethod(String authMethod) {
- this.authMethod = authMethod;
- }
-
public String getAuthMethod() {
return authMethod;
}
- public void setTransportGuarantee(String transportGuarantee) {
- this.transportGuarantee = transportGuarantee;
- }
-
public String getTransportGuarantee() {
return transportGuarantee;
}
- public void setSecureWSDLAccess(Boolean secureWSDLAccess) {
- this.secureWSDLAccess = secureWSDLAccess;
- }
-
public Boolean getSecureWSDLAccess() {
return secureWSDLAccess;
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebserviceDescriptionMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebserviceDescriptionMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebserviceDescriptionMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -24,26 +24,27 @@
/**
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
*/
-public final class JBossWebserviceDescriptionMetaData {
+public final class JBossWebserviceDescriptionMetaData
+{
+ private final String webserviceDescriptionName;
+ private final String wsdlPublishLocation;
- private String webserviceDescriptionName;
- private String wsdlPublishLocation;
+ public JBossWebserviceDescriptionMetaData(String webserviceDescriptionName, String wsdlPublishLocation)
+ {
+ this.webserviceDescriptionName = webserviceDescriptionName;
+ this.wsdlPublishLocation = wsdlPublishLocation;
+ }
- public void setWsdlPublishLocation(final String wsdlPublishLocation) {
- this.wsdlPublishLocation = wsdlPublishLocation;
- }
+ public String getWsdlPublishLocation()
+ {
+ return wsdlPublishLocation;
+ }
- public String getWsdlPublishLocation() {
- return wsdlPublishLocation;
- }
+ public String getWebserviceDescriptionName()
+ {
+ return webserviceDescriptionName;
+ }
- public void setWebserviceDescriptionName(final String webserviceDescriptionName) {
- this.webserviceDescriptionName = webserviceDescriptionName;
- }
-
- public String getWebserviceDescriptionName() {
- return webserviceDescriptionName;
- }
-
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesFactory.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -50,6 +50,10 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
@@ -165,29 +169,34 @@
private JBossWebservicesMetaData parseWebservices(final XMLStreamReader reader, final String nsUri, final URL descriptorURL)
throws XMLStreamException {
- JBossWebservicesMetaData metadata = new JBossWebservicesMetaData(descriptorURL);
+ String contextRoot = null;
+ String configName = null;
+ String configFile = null;
+ List<JBossPortComponentMetaData> jpcmds = new LinkedList<JBossPortComponentMetaData>();
+ List<JBossWebserviceDescriptionMetaData> jwsdmds = new LinkedList<JBossWebserviceDescriptionMetaData>();
+ Map<String, String> props = new HashMap<String, String>();
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
if (match(reader, nsUri, WEBSERVICES)) {
- return metadata;
+ return new JBossWebservicesMetaData(contextRoot, configName, configFile, descriptorURL, props, jpcmds, jwsdmds);
} else {
throw MESSAGES.unexpectedEndTag(getDescriptorForLogs(), reader.getLocalName());
}
}
case XMLStreamConstants.START_ELEMENT: {
if (match(reader, nsUri, CONTEXT_ROOT)) {
- metadata.setContextRoot(getElementText(reader));
+ contextRoot = getElementText(reader);
} else if (match(reader, nsUri, CONFIG_NAME)) {
- metadata.setConfigName(getElementText(reader));
+ configName = getElementText(reader);
} else if (match(reader, nsUri, CONFIG_FILE)) {
- metadata.setConfigFile(getElementText(reader));
+ configFile = getElementText(reader);
} else if (match(reader, nsUri, PROPERTY)) {
- parseProperty(reader, nsUri, metadata);
+ parseProperty(reader, nsUri, props);
} else if (match(reader, nsUri, PORT_COMPONENT)) {
- metadata.addPortComponent(parsePortComponent(reader, nsUri));
+ jpcmds.add(parsePortComponent(reader, nsUri));
} else if (match(reader, nsUri, WEBSERVICE_DESCRIPTION)) {
- metadata.addWebserviceDescription(parseWebserviceDescription(reader, nsUri));
+ jwsdmds.add(parseWebserviceDescription(reader, nsUri));
} else {
throw MESSAGES.unexpectedElement(getDescriptorForLogs(), reader.getLocalName());
}
@@ -198,29 +207,35 @@
}
private JBossPortComponentMetaData parsePortComponent(XMLStreamReader reader, String nsUri) throws XMLStreamException {
- JBossPortComponentMetaData pc = new JBossPortComponentMetaData();
+ String ejbName = null;
+ String portComponentName = null;
+ String portComponentURI = null;
+ String authMethod = null;
+ String transportGuarantee = null;
+ Boolean secureWsdlAccess = null;
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
if (match(reader, nsUri, PORT_COMPONENT)) {
- return pc;
+ return new JBossPortComponentMetaData(ejbName, portComponentName, portComponentURI,
+ authMethod, transportGuarantee, secureWsdlAccess);
} else {
throw MESSAGES.unexpectedEndTag(getDescriptorForLogs(), reader.getLocalName());
}
}
case XMLStreamConstants.START_ELEMENT: {
if (match(reader, nsUri, EJB_NAME)) {
- pc.setEjbName(getElementText(reader));
+ ejbName = getElementText(reader);
} else if (match(reader, nsUri, PORT_COMPONENT_NAME)) {
- pc.setPortComponentName(getElementText(reader));
+ portComponentName = getElementText(reader);
} else if (match(reader, nsUri, PORT_COMPONENT_URI)) {
- pc.setPortComponentURI(getElementText(reader));
+ portComponentURI = getElementText(reader);
} else if (match(reader, nsUri, AUTH_METHOD)) {
- pc.setAuthMethod(getElementText(reader));
+ authMethod = getElementText(reader);
} else if (match(reader, nsUri, TRANSPORT_GUARANTEE)) {
- pc.setTransportGuarantee(getElementText(reader));
+ transportGuarantee = getElementText(reader);
} else if (match(reader, nsUri, SECURE_WSDL_ACCESS)) {
- pc.setSecureWSDLAccess(elementAsBoolean(reader));
+ secureWsdlAccess = elementAsBoolean(reader);
} else {
throw MESSAGES.unexpectedElement(getDescriptorForLogs(), reader.getLocalName());
}
@@ -232,21 +247,22 @@
private JBossWebserviceDescriptionMetaData parseWebserviceDescription(XMLStreamReader reader, String nsUri)
throws XMLStreamException {
- JBossWebserviceDescriptionMetaData description = new JBossWebserviceDescriptionMetaData();
+ String webserviceDescriptionName = null;
+ String wsdlPublishLocation = null;
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
if (match(reader, nsUri, WEBSERVICE_DESCRIPTION)) {
- return description;
+ return new JBossWebserviceDescriptionMetaData(webserviceDescriptionName, wsdlPublishLocation);
} else {
throw MESSAGES.unexpectedEndTag(getDescriptorForLogs(), reader.getLocalName());
}
}
case XMLStreamConstants.START_ELEMENT: {
if (match(reader, nsUri, WEBSERVICE_DESCRIPTION_NAME)) {
- description.setWebserviceDescriptionName(getElementText(reader));
+ webserviceDescriptionName = getElementText(reader);
} else if (match(reader, nsUri, WSDL_PUBLISH_LOCATION)) {
- description.setWsdlPublishLocation(getElementText(reader));
+ wsdlPublishLocation = getElementText(reader);
} else {
throw MESSAGES.unexpectedElement(getDescriptorForLogs(), reader.getLocalName());
}
@@ -256,7 +272,7 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
- private void parseProperty(XMLStreamReader reader, String nsUri, JBossWebservicesMetaData metadata) throws XMLStreamException
+ private void parseProperty(XMLStreamReader reader, String nsUri, Map<String, String> map) throws XMLStreamException
{
String name = null;
String value = null;
@@ -271,7 +287,7 @@
{
throw MESSAGES.couldNotGetPropertyName(getDescriptorForLogs());
}
- metadata.setProperty(name, value);
+ map.put(name, value);
return;
}
else
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/JBossWebservicesMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
+ * Copyright 2013, 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.
*
@@ -23,86 +23,81 @@
package org.jboss.wsf.spi.metadata.webservices;
import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedList;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:alessio.soldano@jboss.com">Alessio Soldano</a>
*/
public final class JBossWebservicesMetaData {
- private String contextRoot;
-
- private String configName;
-
- private String configFile;
+ private final String contextRoot;
+ private final String configName;
+ private final String configFile;
+ private final Map<String, String> properties;
+ private final List<JBossPortComponentMetaData> portComponents;
+ private final List<JBossWebserviceDescriptionMetaData> webserviceDescriptions;
+ private final URL descriptorURL;
- private Map<String, String> properties = new HashMap<String, String>();
-
- private List<JBossPortComponentMetaData> portComponents = new LinkedList<JBossPortComponentMetaData>();
-
- private List<JBossWebserviceDescriptionMetaData> webserviceDescriptions = new LinkedList<JBossWebserviceDescriptionMetaData>();
-
- private URL descriptorURL;
-
- public JBossWebservicesMetaData(final URL descriptorURL) {
- this.descriptorURL = descriptorURL;
+ public JBossWebservicesMetaData(String contextRoot,
+ String configName,
+ String configFile,
+ URL descriptorURL,
+ Map<String, String> properties,
+ List<JBossPortComponentMetaData> portComponents,
+ List<JBossWebserviceDescriptionMetaData> webserviceDescriptions)
+ {
+ this.contextRoot = contextRoot;
+ this.configName = configName;
+ this.configFile = configFile;
+ this.descriptorURL = descriptorURL;
+ if (properties != null && !properties.isEmpty()) {
+ this.properties = Collections.unmodifiableMap(properties);
+ } else {
+ this.properties = Collections.emptyMap();
+ }
+ if (portComponents != null && !portComponents.isEmpty()) {
+ this.portComponents = Collections.unmodifiableList(portComponents);
+ } else {
+ this.portComponents = Collections.emptyList();
+ }
+ if (webserviceDescriptions != null && !webserviceDescriptions.isEmpty()) {
+ this.webserviceDescriptions = Collections.unmodifiableList(webserviceDescriptions);
+ } else {
+ this.webserviceDescriptions = Collections.emptyList();
+ }
}
public URL getDescriptorURL() {
return descriptorURL;
}
- public void setContextRoot(final String contextRoot) {
- this.contextRoot = contextRoot;
- }
-
public String getContextRoot() {
return contextRoot;
}
- public void setConfigName(final String configName) {
- this.configName = configName;
- }
-
public String getConfigName() {
return configName;
}
- public void setConfigFile(final String configFile) {
- this.configFile = configFile;
- }
-
public String getConfigFile() {
return configFile;
}
- public void addPortComponent(final JBossPortComponentMetaData portComponent) {
- portComponents.add(portComponent);
- }
-
public JBossPortComponentMetaData[] getPortComponents() {
final JBossPortComponentMetaData[] array = new JBossPortComponentMetaData[portComponents.size()];
portComponents.toArray(array);
return array;
}
- public void addWebserviceDescription(final JBossWebserviceDescriptionMetaData webserviceDescriptionMD) {
- webserviceDescriptions.add(webserviceDescriptionMD);
- }
-
public JBossWebserviceDescriptionMetaData[] getWebserviceDescriptions() {
final JBossWebserviceDescriptionMetaData[] array = new JBossWebserviceDescriptionMetaData[webserviceDescriptions.size()];
webserviceDescriptions.toArray(array);
return array;
}
- public void setProperty(String name, String value) {
- properties.put(name, value);
- }
-
public String getProperty(String name) {
return properties.get(name);
}
@@ -110,5 +105,4 @@
public Map<String, String> getProperties() {
return properties;
}
-
}
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/PortComponentMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -21,7 +21,7 @@
*/
package org.jboss.wsf.spi.metadata.webservices;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.xml.namespace.QName;
@@ -40,6 +40,7 @@
* <p/>
*
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 15-April-2004
*/
public class PortComponentMetaData
@@ -50,109 +51,129 @@
public static final String PARAMETER_WEBSERVICE_ID = "webserviceID";
// The parent <webservice-description> element
- private WebserviceDescriptionMetaData webserviceDescription;
+ private volatile WebserviceDescriptionMetaData webserviceDescription;
/** The required <port-component-name> element
* This name bears no relationship to the WSDL port name.
* This name must be unique amongst all port component names in a module.
*/
- private String portComponentName;
+ private final String portComponentName;
// The required <wsdl-port> element
- private QName wsdlPort;
+ private final QName wsdlPort;
// The required <service-endpoint-interface> element
- private String serviceEndpointInterface;
+ private final String serviceEndpointInterface;
// The required <ejb-link> or <servlet-link> in the <service-impl-bean> element
- private String ejbLink;
- private String servletLink;
+ private final String ejbLink;
+ private final String servletLink;
// The optional <handler> elements
- private List<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>(2);
+ private final List<UnifiedHandlerMetaData> handlers;
// The HTTP context root
- private String contextRoot;
+ private final String contextRoot;
// -----------------------------------------
// JAX-WS additions
// The optional <adressing> element
- private boolean addressingEnabled;
- private boolean addressingRequired;
- private String addressingResponses = "ALL";
+ private final boolean addressingEnabled;
+ private final boolean addressingRequired;
+ private final String addressingResponses;
// The optional <enable-mtom> element
- private boolean mtomEnabled;
+ private final boolean mtomEnabled;
// The optional <mtom-threshold> element
- private int mtomThreshold;
+ private final int mtomThreshold;
// @RespectBinding annotation metadata
- private boolean respectBindingEnabled;
- private QName wsdlService;
- private String protocolBinding;
- private UnifiedHandlerChainsMetaData handlerChains;
+ private final boolean respectBindingEnabled;
+ private final QName wsdlService;
+ private final String protocolBinding;
+ private final UnifiedHandlerChainsMetaData handlerChains;
-
- /** Construct a new PortComponentMetaData for a given WebserviceDescriptionMetaData
- */
- public PortComponentMetaData(WebserviceDescriptionMetaData webserviceDescription)
+ public PortComponentMetaData(String portComponentName,
+ QName wsdlPort,
+ String serviceEndpointInterface,
+ String ejbLink,
+ String servletLink,
+ List<UnifiedHandlerMetaData> handlers,
+ String contextRoot,
+ boolean addressingEnabled,
+ boolean addressingRequired,
+ String addressingResponses,
+ boolean mtomEnabled,
+ int mtomThreshold,
+ boolean respectBindingEnabled,
+ QName wsdlService,
+ String protocolBinding,
+ UnifiedHandlerChainsMetaData handlerChains)
{
- this.webserviceDescription = webserviceDescription;
+ this.portComponentName = portComponentName;
+ if (wsdlPort.getNamespaceURI().length() == 0)
+ Loggers.METADATA_LOGGER.webservicesXmlElementNotNamespaceQualified(wsdlPort);
+ this.wsdlPort = wsdlPort;
+ this.serviceEndpointInterface = serviceEndpointInterface;
+ this.ejbLink = ejbLink;
+ this.servletLink = servletLink;
+ if (handlers != null && !handlers.isEmpty()) {
+ this.handlers = Collections.unmodifiableList(handlers);
+ } else {
+ this.handlers = Collections.emptyList();
+ }
+ this.contextRoot = contextRoot;
+ this.addressingEnabled = addressingEnabled;
+ this.addressingRequired = addressingRequired;
+ if (!"ANONYMOUS".equals(addressingResponses) && !"NON_ANONYMOUS".equals(addressingResponses) && !"ALL".equals(addressingResponses))
+ throw Messages.MESSAGES.unsupportedAddressingResponseType(addressingResponses);
+ this.addressingResponses = addressingResponses;
+ this.mtomEnabled = mtomEnabled;
+ this.mtomThreshold = mtomThreshold;
+ this.respectBindingEnabled = respectBindingEnabled;
+ this.wsdlService = wsdlService;
+ this.protocolBinding = protocolBinding;
+ this.handlerChains = handlerChains;
}
+ public PortComponentMetaData(String portComponentName, QName wsdlPort, String serviceEndpointInterface,
+ String ejbLink, String servletLink, List<UnifiedHandlerMetaData> handlers, String contextRoot,
+ QName wsdlService, String protocolBinding, UnifiedHandlerChainsMetaData handlerChains)
+ {
+ this(portComponentName, wsdlPort, serviceEndpointInterface, ejbLink, servletLink, handlers, contextRoot,
+ false, false, "ALL", false, 0, false, wsdlService, protocolBinding, handlerChains);
+ }
+
public WebserviceDescriptionMetaData getWebserviceDescription()
{
return webserviceDescription;
}
+
+ protected void setWebserviceDescription(WebserviceDescriptionMetaData webserviceDescription)
+ {
+ this.webserviceDescription = webserviceDescription;
+ }
public String getPortComponentName()
{
return portComponentName;
}
- public void setPortComponentName(String portComponentName)
- {
- this.portComponentName = portComponentName;
- }
-
public QName getWsdlPort()
{
return wsdlPort;
}
- public void setWsdlPort(QName wsdlPort)
- {
- if (wsdlPort.getNamespaceURI().length() == 0)
- Loggers.METADATA_LOGGER.webservicesXmlElementNotNamespaceQualified(wsdlPort);
-
- this.wsdlPort = wsdlPort;
- }
-
public String getEjbLink()
{
return ejbLink;
}
- public void setEjbLink(String ejbLink)
- {
- this.ejbLink = ejbLink;
- }
-
public String getServletLink()
{
return servletLink;
}
- public void setServletLink(String servletLink)
- {
- this.servletLink = servletLink;
- }
-
public String getServiceEndpointInterface()
{
return serviceEndpointInterface;
}
- public void setServiceEndpointInterface(String serviceEndpointInterface)
- {
- this.serviceEndpointInterface = serviceEndpointInterface;
- }
-
public void addHandler(UnifiedHandlerMetaData handler)
{
handlers.add(handler);
@@ -170,60 +191,26 @@
return contextRoot;
}
- public void setContextRoot(String contextRoot)
- {
- this.contextRoot = contextRoot;
- }
-
- public void setAddressingEnabled(final boolean addressingEnabled) {
- this.addressingEnabled = addressingEnabled;
- }
-
public boolean isAddressingEnabled() {
return this.addressingEnabled;
}
- public void setAddressingRequired(final boolean addressingRequired) {
- this.addressingRequired = addressingRequired;
- }
-
public boolean isAddressingRequired() {
return this.addressingRequired;
}
- public void setAddressingResponses(final String responsesTypes)
- {
- if (!"ANONYMOUS".equals(responsesTypes) && !"NON_ANONYMOUS".equals(responsesTypes) && !"ALL".equals(responsesTypes))
- throw Messages.MESSAGES.unsupportedAddressingResponseType(responsesTypes);
-
- this.addressingResponses = responsesTypes;
- }
-
public String getAddressingResponses() {
return this.addressingResponses;
}
- public void setMtomEnabled(final boolean mtomEnabled) {
- this.mtomEnabled = mtomEnabled;
- }
-
public boolean isMtomEnabled() {
return this.mtomEnabled;
}
- public void setMtomThreshold(final int mtomThreshold)
- {
- this.mtomThreshold = mtomThreshold;
- }
-
public int getMtomThreshold() {
return this.mtomThreshold;
}
- public void setRespectBindingEnabled(final boolean respectBindingEnabled) {
- this.respectBindingEnabled = respectBindingEnabled;
- }
-
public boolean isRespectBindingEnabled() {
return this.respectBindingEnabled;
}
@@ -233,31 +220,16 @@
return wsdlService;
}
- public void setWsdlService(QName wsdlService)
- {
- this.wsdlService = wsdlService;
- }
-
public String getProtocolBinding()
{
return protocolBinding;
}
- public void setProtocolBinding(String protocolBinding)
- {
- this.protocolBinding = protocolBinding;
- }
-
public UnifiedHandlerChainsMetaData getHandlerChains()
{
return handlerChains;
}
- public void setHandlerChains(UnifiedHandlerChainsMetaData handlerChains)
- {
- this.handlerChains = handlerChains;
- }
-
public String serialize()
{
StringBuilder builder = new StringBuilder("<port-component>");
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebserviceDescriptionMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -22,8 +22,11 @@
package org.jboss.wsf.spi.metadata.webservices;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
@@ -34,35 +37,54 @@
* XML Binding element for <code>webservices/webservice-description</code>
*
* @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
* @since 15-April-2004
*/
public class WebserviceDescriptionMetaData
{
// The parent <webservices> element
- private WebservicesMetaData webservices;
+ private volatile WebservicesMetaData webservices;
// The required <webservice-description-name> element
- private String webserviceDescriptionName;
+ private final String webserviceDescriptionName;
// The required <wsdl-file> element
- private String wsdlFile;
+ private final String wsdlFile;
// The required <jaxrpc-mapping-file> element
- private String jaxrpcMappingFile;
+ private final String jaxrpcMappingFile;
// The required <port-component> elements
- private ArrayList<PortComponentMetaData> portComponents = new ArrayList<PortComponentMetaData>();
-
- public WebserviceDescriptionMetaData(WebservicesMetaData webservices)
+ private final List<PortComponentMetaData> portComponents; // = new ArrayList<PortComponentMetaData>();
+
+ public WebserviceDescriptionMetaData(String webserviceDescriptionName,
+ String wsdlFile, String jaxrpcMappingFile, PortComponentMetaData... portComponents)
{
+ this(webserviceDescriptionName, wsdlFile, jaxrpcMappingFile, portComponents != null ? Arrays.asList(portComponents) : null);
+ }
+
+ public WebserviceDescriptionMetaData(String webserviceDescriptionName,
+ String wsdlFile, String jaxrpcMappingFile, List<PortComponentMetaData> portComponents)
+ {
this.webservices = webservices;
+ this.webserviceDescriptionName = webserviceDescriptionName;
+ this.wsdlFile = wsdlFile;
+ this.jaxrpcMappingFile = jaxrpcMappingFile;
+ if (portComponents != null && !portComponents.isEmpty()) {
+ this.portComponents = Collections.unmodifiableList(portComponents);
+ for (PortComponentMetaData pcm : portComponents) {
+ pcm.setWebserviceDescription(this);
+ }
+ } else {
+ this.portComponents = Collections.emptyList();
+ }
}
public WebservicesMetaData getWebservices()
{
return webservices;
}
-
- public void addPortComponent(PortComponentMetaData portComponent)
+
+ protected void setWebservices(WebservicesMetaData webservices)
{
- portComponents.add(portComponent);
+ this.webservices = webservices;
}
public PortComponentMetaData[] getPortComponents()
@@ -129,31 +151,16 @@
return webserviceDescriptionName;
}
- public void setWebserviceDescriptionName(String webserviceDescriptionName)
- {
- this.webserviceDescriptionName = webserviceDescriptionName;
- }
-
public String getWsdlFile()
{
return wsdlFile;
}
- public void setWsdlFile(String wsdlFile)
- {
- this.wsdlFile = wsdlFile;
- }
-
public String getJaxrpcMappingFile()
{
return jaxrpcMappingFile;
}
- public void setJaxrpcMappingFile(String jaxrpcMappingFile)
- {
- this.jaxrpcMappingFile = jaxrpcMappingFile;
- }
-
/**
* Serialize as a String
*
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesFactory.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -59,7 +59,10 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -67,6 +70,8 @@
import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
import org.jboss.wsf.spi.metadata.AbstractHandlerChainsMetaDataParser;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
import org.jboss.wsf.spi.util.StAXUtils;
/**
@@ -197,7 +202,7 @@
private WebservicesMetaData parseWebservices(XMLStreamReader reader, String nsUri, URL descriptorURL) throws XMLStreamException
{
- WebservicesMetaData metadata = new WebservicesMetaData(descriptorURL);
+ List<WebserviceDescriptionMetaData> wsdmds = new ArrayList<WebserviceDescriptionMetaData>(2);
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -205,7 +210,7 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, nsUri, WEBSERVICES))
{
- return metadata;
+ return new WebservicesMetaData(descriptorURL, wsdmds);
}
else
{
@@ -214,7 +219,7 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, WEBSERVICE_DESCRIPTION)) {
- metadata.addWebserviceDescription(parseWebserviceDescription(reader, nsUri, metadata));
+ wsdmds.add(parseWebserviceDescription(reader, nsUri));
} else if (match(reader, nsUri, "description") || match(reader, nsUri, "display-name")) {
//skip to parse
getElementText(reader);
@@ -235,9 +240,12 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
- WebserviceDescriptionMetaData parseWebserviceDescription(XMLStreamReader reader, String nsUri, WebservicesMetaData wsMetaData) throws XMLStreamException
+ WebserviceDescriptionMetaData parseWebserviceDescription(XMLStreamReader reader, String nsUri) throws XMLStreamException
{
- WebserviceDescriptionMetaData description = new WebserviceDescriptionMetaData(wsMetaData);
+ String wsdlFile = null;
+ String descriptionName = null;
+ String jaxrpcMappingFile = null;
+ List<PortComponentMetaData> pcms = new ArrayList<PortComponentMetaData>();
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -245,7 +253,7 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, nsUri, WEBSERVICE_DESCRIPTION))
{
- return description;
+ return new WebserviceDescriptionMetaData(descriptionName, wsdlFile, jaxrpcMappingFile, pcms);
}
else
{
@@ -254,16 +262,16 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, WEBSERVICE_DESCRIPTION_NAME)) {
- description.setWebserviceDescriptionName(getElementText(reader));
+ descriptionName = getElementText(reader);
}
else if (match(reader, nsUri, WSDL_FILE)) {
- description.setWsdlFile(getElementText(reader));
+ wsdlFile = getElementText(reader);
}
else if (match(reader, nsUri, JAXRPC_MAPPING_FILE)) {
- description.setJaxrpcMappingFile(getElementText(reader));
+ jaxrpcMappingFile = getElementText(reader);
}
else if (match(reader, nsUri, PORT_COMPONENT)) {
- description.addPortComponent(parsePortComponent(reader, nsUri, description));
+ pcms.add(parsePortComponent(reader, nsUri));
}
else
{
@@ -275,9 +283,20 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
- private PortComponentMetaData parsePortComponent(XMLStreamReader reader, String nsUri, WebserviceDescriptionMetaData desc) throws XMLStreamException
+ private PortComponentMetaData parsePortComponent(XMLStreamReader reader, String nsUri) throws XMLStreamException
{
- PortComponentMetaData pc = new PortComponentMetaData(desc);
+ boolean respectBindingEnabled = false;
+ PortComponentAddressing addressing = new PortComponentAddressing();
+ PortComponentLinks links = new PortComponentLinks();
+ String name = null;
+ QName wsdlService = null;
+ QName wsdlPort = null;
+ boolean mtomEnabled = false;
+ int mtomThreshold = 0;
+ String protocolBinding = null;
+ String serviceEndpointInterface = null;
+ UnifiedHandlerChainsMetaData uhcs = null;
+ List<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>(2);
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -285,7 +304,8 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, nsUri, PORT_COMPONENT))
{
- return pc;
+ return new PortComponentMetaData(name, wsdlPort, serviceEndpointInterface, links.ejb, links.servlet, handlers, null, addressing.enabled,
+ addressing.required, addressing.responses, mtomEnabled, mtomThreshold, respectBindingEnabled, wsdlService, protocolBinding, uhcs);
}
else
{
@@ -294,7 +314,7 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, PORT_COMPONENT_NAME)) {
- pc.setPortComponentName(getElementText(reader));
+ name = getElementText(reader);
}
else if (match(reader, nsUri, "description") || match(reader, nsUri, "display-name")) {
//skip to parse
@@ -306,37 +326,37 @@
}
}
else if (match(reader, nsUri, WSDL_SERVICE)) {
- pc.setWsdlService(elementAsQName(reader));
+ wsdlService = elementAsQName(reader);
}
else if (match(reader, nsUri, WSDL_PORT)) {
- pc.setWsdlPort(elementAsQName(reader));
+ wsdlPort = elementAsQName(reader);
}
else if (match(reader, nsUri, ENABLE_MTOM)) {
- pc.setMtomEnabled(elementAsBoolean(reader));
+ mtomEnabled = elementAsBoolean(reader);
}
else if (match(reader, nsUri, MTOM_THRESHOLD)) {
- pc.setMtomThreshold(elementAsInt(reader));
+ mtomThreshold = elementAsInt(reader);
}
else if (match(reader, nsUri, ADDRESSING)) {
- parseAddressing(reader, nsUri, pc);
+ parseAddressing(reader, nsUri, addressing);
}
else if (match(reader, nsUri, RESPECT_BINDING)) {
- parseRespectBinding(reader, nsUri, pc);
+ respectBindingEnabled = parseRespectBinding(reader, nsUri);
}
else if (match(reader, nsUri, PROTOCOL_BINDING)) {
- pc.setProtocolBinding(getElementText(reader));
+ protocolBinding = getElementText(reader);
}
else if (match(reader, nsUri, SERVICE_ENDPOINT_INTERFACE)) {
- pc.setServiceEndpointInterface(getElementText(reader));
+ serviceEndpointInterface = getElementText(reader);
}
else if (match(reader, nsUri, SERVICE_IMPL_BEAN)) {
- parseServiceImplBean(reader, nsUri, pc);
+ parseServiceImplBean(reader, nsUri, links);
}
else if (match(reader, nsUri, HANDLER_CHAINS)) {
- pc.setHandlerChains(parseHandlerChains(reader, nsUri));
+ uhcs = parseHandlerChains(reader, nsUri);
}
else if (match(reader, nsUri, HANDLER)) {
- pc.addHandler(parseHandler(reader, nsUri));
+ handlers.add(parseHandler(reader, nsUri));
}
else
{
@@ -352,7 +372,7 @@
return elementAsString(reader);
}
- private void parseAddressing(XMLStreamReader reader, String nsUri, PortComponentMetaData pc) throws XMLStreamException
+ private void parseAddressing(XMLStreamReader reader, String nsUri, PortComponentAddressing pca) throws XMLStreamException
{
while (reader.hasNext())
{
@@ -370,13 +390,13 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, ENABLED)) {
- pc.setAddressingEnabled(elementAsBoolean(reader));
+ pca.enabled = elementAsBoolean(reader);
}
else if (match(reader, nsUri, REQUIRED)) {
- pc.setAddressingRequired(elementAsBoolean(reader));
+ pca.required = elementAsBoolean(reader);
}
else if (match(reader, nsUri, ADDRESSING_RESPONSES)) {
- pc.setAddressingResponses(getElementText(reader));
+ pca.responses = getElementText(reader);
}
else
{
@@ -388,8 +408,15 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
- private void parseRespectBinding(XMLStreamReader reader, String nsUri, PortComponentMetaData pc) throws XMLStreamException
+ private class PortComponentAddressing {
+ public boolean enabled = false;
+ public boolean required = false;
+ public String responses = "ALL";
+ }
+
+ private boolean parseRespectBinding(XMLStreamReader reader, String nsUri) throws XMLStreamException
{
+ boolean respectBindingEnabled = false;
while (reader.hasNext())
{
switch (reader.nextTag())
@@ -397,7 +424,7 @@
case XMLStreamConstants.END_ELEMENT : {
if (match(reader, nsUri, RESPECT_BINDING))
{
- return;
+ return respectBindingEnabled;
}
else
{
@@ -406,7 +433,7 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, ENABLED)) {
- pc.setRespectBindingEnabled(elementAsBoolean(reader));
+ respectBindingEnabled = elementAsBoolean(reader);
}
else
{
@@ -418,7 +445,7 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
- private void parseServiceImplBean(XMLStreamReader reader, String nsUri, PortComponentMetaData pc) throws XMLStreamException
+ private void parseServiceImplBean(XMLStreamReader reader, String nsUri, PortComponentLinks pcl) throws XMLStreamException
{
while (reader.hasNext())
{
@@ -436,10 +463,10 @@
}
case XMLStreamConstants.START_ELEMENT : {
if (match(reader, nsUri, SERVLET_LINK)) {
- pc.setServletLink(getElementText(reader));
+ pcl.servlet = getElementText(reader);
}
else if (match(reader, nsUri, EJB_LINK)) {
- pc.setEjbLink(getElementText(reader));
+ pcl.ejb = getElementText(reader);
}
else
{
@@ -451,6 +478,11 @@
throw MESSAGES.reachedEndOfXMLDocUnexpectedly(getDescriptorForLogs());
}
+ private class PortComponentLinks {
+ public String servlet;
+ public String ejb;
+ }
+
@Override
protected String getDescriptorForLogs() {
return descriptorURL != null ? descriptorURL.toString() : "webservices.xml";
Modified: spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.java
===================================================================
--- spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/webservices/WebservicesMetaData.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, 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.
*
@@ -22,28 +22,40 @@
package org.jboss.wsf.spi.metadata.webservices;
import java.net.URL;
-import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
/**
* XML Binding root element for <code>webservices.xml</code>
*
* @author Thomas.Diesler(a)jboss.org
+ * @autor alessio.soldano(a)jboss.com
* @since 15-April-2004
*/
public class WebservicesMetaData
{
// The required <webservice-description> elements
- private ArrayList<WebserviceDescriptionMetaData> webserviceDescriptions = new ArrayList<WebserviceDescriptionMetaData>(2);
+ private final List<WebserviceDescriptionMetaData> webserviceDescriptions;
// The URL to the webservices.xml descriptor
- private URL descriptorURL;
-
- public WebservicesMetaData()
+ private final URL descriptorURL;
+
+ public WebservicesMetaData(URL descriptorURL, WebserviceDescriptionMetaData... webserviceDescriptions)
{
+ this(descriptorURL, webserviceDescriptions != null ? Arrays.asList(webserviceDescriptions) : null);
}
-
- public WebservicesMetaData(URL descriptorURL)
+
+ public WebservicesMetaData(URL descriptorURL, List<WebserviceDescriptionMetaData> webserviceDescriptions)
{
+ if (webserviceDescriptions != null && !webserviceDescriptions.isEmpty()) {
+ this.webserviceDescriptions = Collections.unmodifiableList(webserviceDescriptions);
+ for (WebserviceDescriptionMetaData wsdmd : webserviceDescriptions) {
+ wsdmd.setWebservices(this);
+ }
+ } else {
+ this.webserviceDescriptions = Collections.emptyList();
+ }
this.descriptorURL = descriptorURL;
}
@@ -52,11 +64,6 @@
return descriptorURL;
}
- public void addWebserviceDescription(WebserviceDescriptionMetaData webserviceDescription)
- {
- webserviceDescriptions.add(webserviceDescription);
- }
-
public WebserviceDescriptionMetaData[] getWebserviceDescriptions()
{
WebserviceDescriptionMetaData[] array = new WebserviceDescriptionMetaData[webserviceDescriptions.size()];
Modified: spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/config/ConfigMDParserTestCase.java
===================================================================
--- spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/config/ConfigMDParserTestCase.java 2014-01-16 02:38:52 UTC (rev 18244)
+++ spi/trunk/src/test/java/org/jboss/test/wsf/spi/metadata/config/ConfigMDParserTestCase.java 2014-01-16 14:45:03 UTC (rev 18245)
@@ -51,8 +51,8 @@
ClientConfig cc = clientConfigs.get(0);
assertEquals("Standard Client", cc.getConfigName());
assertTrue(cc.getProperties().isEmpty());
- assertNull(cc.getPreHandlerChains());
- assertNull(cc.getPostHandlerChains());
+ assertTrue(cc.getPreHandlerChains() == null || cc.getPreHandlerChains().isEmpty());
+ assertTrue(cc.getPostHandlerChains() == null || cc.getPostHandlerChains().isEmpty());
List<EndpointConfig> endpointConfigs = metadata.getEndpointConfig();
assertEquals(2, endpointConfigs.size());
@@ -67,8 +67,8 @@
assertEquals("value2", ec.getProperty("name2"));
ec = metadata.getEndpointConfigByName(".NET friendly Endpoint");
- assertNull(ec.getPreHandlerChains());
- assertNull(ec.getPostHandlerChains());
+ assertTrue(ec.getPreHandlerChains() == null || ec.getPreHandlerChains().isEmpty());
+ assertTrue(ec.getPostHandlerChains() == null || ec.getPostHandlerChains().isEmpty());
assertTrue(ec.getProperties().isEmpty());
assertTrue(ec.hasFeature("http://org.jboss.ws/binding/wsdl/dotnet"));
}
10 years, 11 months
JBossWS SVN: r18243 - common/trunk/src/main/java/org/jboss/ws/common/injection.
by jbossws-commits@lists.jboss.org
Author: ropalka
Date: 2014-01-15 10:43:26 -0500 (Wed, 15 Jan 2014)
New Revision: 18243
Modified:
common/trunk/src/main/java/org/jboss/ws/common/injection/ThreadLocalAwareWebServiceContext.java
Log:
rollback previous commit
Modified: common/trunk/src/main/java/org/jboss/ws/common/injection/ThreadLocalAwareWebServiceContext.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/injection/ThreadLocalAwareWebServiceContext.java 2014-01-15 15:17:39 UTC (rev 18242)
+++ common/trunk/src/main/java/org/jboss/ws/common/injection/ThreadLocalAwareWebServiceContext.java 2014-01-15 15:43:26 UTC (rev 18243)
@@ -56,36 +56,31 @@
public EndpointReference getEndpointReference(final Element... referenceParameters)
{
- return getWebServiceContextInternal().getEndpointReference(referenceParameters);
+ return getWebServiceContext().getEndpointReference(referenceParameters);
}
public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz, final Element... referenceParameters)
{
- return getWebServiceContextInternal().getEndpointReference(clazz, referenceParameters);
+ return getWebServiceContext().getEndpointReference(clazz, referenceParameters);
}
public MessageContext getMessageContext()
{
- return getWebServiceContextInternal().getMessageContext();
+ return getWebServiceContext().getMessageContext();
}
public Principal getUserPrincipal()
{
- return getWebServiceContextInternal().getUserPrincipal();
+ return getWebServiceContext().getUserPrincipal();
}
public boolean isUserInRole(String role)
{
- return getWebServiceContextInternal().isUserInRole(role);
+ return getWebServiceContext().isUserInRole(role);
}
- public WebServiceContext getWebServiceContext()
+ private WebServiceContext getWebServiceContext()
{
- return contexts.get();
- }
-
- private WebServiceContext getWebServiceContextInternal()
- {
final WebServiceContext delegate = contexts.get();
if (delegate == null)
10 years, 11 months
JBossWS SVN: r18242 - common/trunk/src/main/java/org/jboss/ws/common/injection.
by jbossws-commits@lists.jboss.org
Author: ropalka
Date: 2014-01-15 10:17:39 -0500 (Wed, 15 Jan 2014)
New Revision: 18242
Modified:
common/trunk/src/main/java/org/jboss/ws/common/injection/ThreadLocalAwareWebServiceContext.java
Log:
prepare for JSR-236 support - exposing current msg context retrieval method
Modified: common/trunk/src/main/java/org/jboss/ws/common/injection/ThreadLocalAwareWebServiceContext.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/injection/ThreadLocalAwareWebServiceContext.java 2014-01-15 11:06:08 UTC (rev 18241)
+++ common/trunk/src/main/java/org/jboss/ws/common/injection/ThreadLocalAwareWebServiceContext.java 2014-01-15 15:17:39 UTC (rev 18242)
@@ -56,31 +56,36 @@
public EndpointReference getEndpointReference(final Element... referenceParameters)
{
- return getWebServiceContext().getEndpointReference(referenceParameters);
+ return getWebServiceContextInternal().getEndpointReference(referenceParameters);
}
public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz, final Element... referenceParameters)
{
- return getWebServiceContext().getEndpointReference(clazz, referenceParameters);
+ return getWebServiceContextInternal().getEndpointReference(clazz, referenceParameters);
}
public MessageContext getMessageContext()
{
- return getWebServiceContext().getMessageContext();
+ return getWebServiceContextInternal().getMessageContext();
}
public Principal getUserPrincipal()
{
- return getWebServiceContext().getUserPrincipal();
+ return getWebServiceContextInternal().getUserPrincipal();
}
public boolean isUserInRole(String role)
{
- return getWebServiceContext().isUserInRole(role);
+ return getWebServiceContextInternal().isUserInRole(role);
}
- private WebServiceContext getWebServiceContext()
+ public WebServiceContext getWebServiceContext()
{
+ return contexts.get();
+ }
+
+ private WebServiceContext getWebServiceContextInternal()
+ {
final WebServiceContext delegate = contexts.get();
if (delegate == null)
10 years, 11 months
JBossWS SVN: r18241 - stack/cxf/trunk/modules/addons/transports/http/undertow.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-01-15 06:06:08 -0500 (Wed, 15 Jan 2014)
New Revision: 18241
Modified:
stack/cxf/trunk/modules/addons/transports/http/undertow/
Log:
Setting svn:ignore props
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow
___________________________________________________________________
Added: svn:ignore
+ target
.project
.classpath
.settings
10 years, 11 months
JBossWS SVN: r18240 - stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-01-15 06:03:47 -0500 (Wed, 15 Jan 2014)
New Revision: 18240
Modified:
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java
Log:
[JBWS-3702] updating fixme
Modified: stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java 2014-01-15 10:00:35 UTC (rev 18239)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java 2014-01-15 11:03:47 UTC (rev 18240)
@@ -85,7 +85,7 @@
factory = new UndertowServerEngineFactory(bus);
UndertowServerEngine engine = factory.createHttpServerEngine("localhost", 9234, "http");
assertTrue("http".equals(engine.getProtocol()));
- System.out.println("[JBWS-3079] FIXME: Add support for https protocol");
+ System.out.println("[JBWS-3702] FIXME: Add support for https protocol");
//UndertowServerEngine engine2 = factory.createHttpServerEngine("localhost", 9235, "https");
//assertTrue("https".equals(engine2.getProtocol()));
factory.destroyForPort(9234);
10 years, 11 months
JBossWS SVN: r18239 - in stack/cxf/trunk: modules/addons and 39 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-01-15 05:00:35 -0500 (Wed, 15 Jan 2014)
New Revision: 18239
Added:
stack/cxf/trunk/modules/addons/transports/http/undertow/
stack/cxf/trunk/modules/addons/transports/http/undertow/pom.xml
stack/cxf/trunk/modules/addons/transports/http/undertow/src/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/SecurityActions.java
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestination.java
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/resources/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/resources/META-INF/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/resources/META-INF/cxf/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/resources/META-INF/cxf/bus-extensions.txt
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/resources/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-transports-undertow/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-transports-undertow/main/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-transports-undertow/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-undertow-httpspi/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-undertow-httpspi/main/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-undertow-httpspi/main/module.xml
Removed:
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-transports-httpserver/
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-jboss-httpserver-httpspi/
Modified:
stack/cxf/trunk/modules/addons/pom.xml
stack/cxf/trunk/modules/dist/pom.xml
stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/as/webservices/server/integration/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-client/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-client/main/module.xml
stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
stack/cxf/trunk/modules/resources/src/main/resources/resources/modules-deploy.conf
stack/cxf/trunk/pom.xml
Log:
[JBWS-3702]:Add Undertow HttpDestinationFactory; Replace old httpserver integration(modules) with new undertow implementation
Modified: stack/cxf/trunk/modules/addons/pom.xml
===================================================================
--- stack/cxf/trunk/modules/addons/pom.xml 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/addons/pom.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -17,6 +17,7 @@
<!-- Modules -->
<modules>
<module>transports/http/httpserver</module>
+ <module>transports/http/undertow</module>
<module>transports/udp</module>
</modules>
Added: stack/cxf/trunk/modules/addons/transports/http/undertow/pom.xml
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/pom.xml (rev 0)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/pom.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,92 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss Web Services - Stack CXF Undertow http transport</name>
+ <artifactId>jbossws-cxf-transports-undertow</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.jboss.ws.cxf</groupId>
+ <artifactId>jbossws-cxf-addons</artifactId>
+ <version>4.3.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.ws.projects</groupId>
+ <artifactId>jaxws-undertow-httpspi</artifactId>
+ </dependency>
+
+ <!-- CXF dependencies -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxws</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http</artifactId>
+ </dependency>
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-asm</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-expression</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jms</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ </dependency>
+
+ <!--
+ useStrictFiltering requires dependency in all included modules
+ http://jira.codehaus.org/browse/MASSEMBLY-317
+ -->
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.xml.ws</groupId>
+ <artifactId>jboss-jaxws-api_2.2_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/SecurityActions.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/SecurityActions.java (rev 0)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/SecurityActions.java 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.wsf.stack.cxf.addons.transports.undertow;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Feb-2011
+ *
+ */
+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 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;
+ }
+ });
+ }
+ }
+
+}
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/SecurityActions.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestination.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestination.java (rev 0)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestination.java 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.wsf.stack.cxf.addons.transports.undertow;
+
+import io.undertow.server.HttpServerExchange;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.http.DestinationRegistry;
+import org.apache.cxf.transport.http_jaxws_spi.HttpHandlerImpl;
+import org.apache.cxf.transport.http_jaxws_spi.JAXWSHttpSpiDestination;
+import org.jboss.ws.undertow_httpspi.UndertowHttpExchange;
+
+/**
+ * HTTP destination to be used with the JDK6 httpserver; this extends the
+ * basic JAXWSHttpSpiDestination with all the mechanisms for properly
+ * handling destination and factory life-cycles.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ * @since 19-Aug-2010
+ *
+ */
+public class UndertowServerDestination extends JAXWSHttpSpiDestination
+{
+ static final Logger LOG = LogUtils.getL7dLogger(UndertowServerDestination.class);
+
+ private UndertowServerEngineFactory serverEngineFactory;
+ private UndertowServerEngine engine;
+ private URL url;
+
+ public UndertowServerDestination(Bus b, DestinationRegistry registry, EndpointInfo ei) throws IOException
+ {
+ super(b, registry, ei);
+ this.serverEngineFactory = getServerEngineFactory();
+ getAddressValue(ei, true); //generate address if not specified
+ this.url = new URL(ei.getAddress());
+ }
+
+ @Override
+ protected Logger getLogger()
+ {
+ return LOG;
+ }
+
+ public void finalizeConfig()
+ {
+ engine = serverEngineFactory.retrieveHttpServerEngine(url.getPort());
+ if (engine == null)
+ {
+ try
+ {
+ engine = serverEngineFactory.createHttpServerEngine(url.getHost(), url.getPort(), url.getProtocol());
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ if (!url.getProtocol().equals(engine.getProtocol()))
+ {
+ throw new IllegalStateException("Port " + engine.getPort() + " is configured with wrong protocol \""
+ + engine.getProtocol() + "\" for \"" + url + "\"");
+ }
+ }
+
+ protected UndertowServerEngineFactory getServerEngineFactory()
+ {
+ UndertowServerEngineFactory serverEngineFactory = getBus().getExtension(UndertowServerEngineFactory.class);
+ // If it's not there, then create it and register it.
+ // Spring may override it later, but we need it here for default
+ // with no spring configuration.
+ if (serverEngineFactory == null)
+ {
+ serverEngineFactory = new UndertowServerEngineFactory(bus);
+ }
+ return serverEngineFactory;
+ }
+
+ /**
+ * Activate receipt of incoming messages.
+ */
+ protected void activate()
+ {
+ LOG.log(Level.FINE, "Activating receipt of incoming messages");
+ String addr = endpointInfo.getAddress();
+ try
+ {
+ new URL(addr);
+ }
+ catch (Exception e)
+ {
+ throw new Fault(e);
+ }
+ engine.addHandler(addr, new Handler(this, SecurityActions.getContextClassLoader()));
+ }
+
+ /**
+ * Deactivate receipt of incoming messages.
+ */
+ protected void deactivate()
+ {
+ LOG.log(Level.FINE, "Deactivating receipt of incoming messages");
+ engine.removeHandler(endpointInfo.getAddress());
+ }
+
+ class Handler extends HttpHandlerImpl implements io.undertow.server.HttpHandler
+ {
+
+ private ClassLoader classLoader;
+
+ public Handler(JAXWSHttpSpiDestination destination, ClassLoader classLoader)
+ {
+ super(destination);
+ this.classLoader = classLoader;
+ }
+
+
+ @Override
+ public void handleRequest(HttpServerExchange exchange) throws Exception
+ {
+ ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
+ try
+ {
+ SecurityActions.setContextClassLoader(this.classLoader);
+ this.handle(new UndertowHttpExchange(exchange));
+ }
+ catch (Exception e)
+ {
+ LOG.throwing(Handler.class.getName(), "handle(" + HttpServerExchange.class.getName() + " ex)", e);
+ if (e instanceof IOException)
+ {
+ throw (IOException) e;
+ }
+ else
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ finally
+ {
+ SecurityActions.setContextClassLoader(origClassLoader);
+ }
+
+ }
+ }
+
+}
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestination.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java (rev 0)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.wsf.stack.cxf.addons.transports.undertow;
+
+import java.io.IOException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.http.AbstractHTTPDestination;
+import org.apache.cxf.transport.http.DestinationRegistry;
+import org.apache.cxf.transport.http.HttpDestinationFactory;
+
+
+/**
+ * Factory for HttpServerDestination
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Apr-2011
+ *
+ */
+@NoJSR250Annotations()
+public class UndertowServerDestinationFactory implements HttpDestinationFactory
+{
+ @Override
+ public AbstractHTTPDestination createDestination(EndpointInfo endpointInfo, Bus bus, DestinationRegistry registry)
+ throws IOException
+ {
+ return new UndertowServerDestination(bus, registry, endpointInfo);
+ }
+}
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerDestinationFactory.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java (rev 0)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.wsf.stack.cxf.addons.transports.undertow;
+
+import java.net.InetSocketAddress;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.jboss.ws.undertow_httpspi.PathUtils;
+import org.jboss.ws.undertow_httpspi.UndertowServer;
+import io.undertow.server.HttpHandler;
+
+/**
+ * A server engine that internally uses the JDK6 httpserver
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ * @since 19-Aug-2010
+ *
+ */
+public class UndertowServerEngine
+{
+ private static final Logger LOG = LogUtils.getL7dLogger(UndertowServerEngine.class);
+ private Bus bus;
+ private UndertowServerEngineFactory factory;
+ private String host;
+ private int port;
+ private int handlerCount;
+ private String protocol = "http";
+ private UndertowServer server;
+
+ public UndertowServerEngine(UndertowServerEngineFactory fac, Bus bus, String host, int port)
+ {
+ this.bus = bus;
+ this.factory = fac;
+ this.host = host;
+ this.port = port;
+ }
+
+ public synchronized Bus getBus()
+ {
+ return bus;
+ }
+
+ public synchronized String getProtocol()
+ {
+ return protocol;
+ }
+
+ public synchronized int getPort()
+ {
+ return port;
+ }
+
+ public synchronized String getHost()
+ {
+ return host;
+ }
+
+ public synchronized void addHandler(String address, HttpHandler handler)
+ {
+ if (server == null) //start the server on first call
+ {
+ InetSocketAddress isa = host != null ? new InetSocketAddress(host, port) : new InetSocketAddress(port);
+
+ server = new UndertowServer(isa.getPort(), isa.getHostName());
+ server.getPathHandler().addExactPath(PathUtils.getContextPath(address) + PathUtils.getPath(address), handler);
+ server.start();
+ }
+ server.getPathHandler().addExactPath(PathUtils.getContextPath(address) + PathUtils.getPath(address), handler);
+
+ handlerCount++;
+ }
+
+ public synchronized void removeHandler(String address)
+ {
+ server.getPathHandler().removeExactPath(PathUtils.getContextPath(address) + PathUtils.getPath(address));
+ handlerCount--;
+ }
+
+ /**
+ * This method is called by the ServerEngine Factory to destroy the server
+ */
+ protected synchronized void stop() throws Exception
+ {
+ if (server != null)
+ {
+ server.stop();
+ }
+ }
+
+ /**
+ * This method will shut down the server engine and
+ * remove it from the factory's cache.
+ */
+ public synchronized void shutdown()
+ {
+ if (factory != null && handlerCount == 0)
+ {
+ factory.destroyForPort(port);
+ }
+ else
+ {
+ LOG.log(Level.WARNING, "FAILED_TO_SHUTDOWN_ENGINE_MSG", port);
+ }
+ }
+}
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngine.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java (rev 0)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.wsf.stack.cxf.addons.transports.undertow;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.buslifecycle.BusLifeCycleListener;
+import org.apache.cxf.buslifecycle.BusLifeCycleManager;
+import org.apache.cxf.common.logging.LogUtils;
+
+/**
+ * A server engine factory for the undertow engine
+ *
+ * @author Magesh Kumar B <mageshbk(a)jboss.com> (C) 2011 Red Hat Inc.
+ * @author alessio.soldano(a)jboss.com
+ * @since 19-Aug-2010
+ *
+ */
+public class UndertowServerEngineFactory implements BusLifeCycleListener
+{
+ private static final Logger LOG = LogUtils.getL7dLogger(UndertowServerEngineFactory.class);
+ private static Map<Integer, UndertowServerEngine> portMap = new HashMap<Integer, UndertowServerEngine>();
+
+ private BusLifeCycleManager lifeCycleManager;
+ private Bus bus;
+
+ public UndertowServerEngineFactory(Bus b)
+ {
+ setBus(b);
+ }
+
+ /**
+ * This call is used to set the bus. It should only be called once.
+ * @param bus
+ */
+ @Resource(name = "cxf")
+ public final void setBus(Bus bus)
+ {
+ assert this.bus == null || this.bus == bus;
+ this.bus = bus;
+ if (bus != null)
+ {
+ bus.setExtension(this, UndertowServerEngineFactory.class);
+ lifeCycleManager = bus.getExtension(BusLifeCycleManager.class);
+ if (null != lifeCycleManager)
+ {
+ lifeCycleManager.registerLifeCycleListener(this);
+ }
+ }
+ }
+
+ public Bus getBus()
+ {
+ return bus;
+ }
+
+ /**
+ * Retrieve a previously configured HttpServerEngine for the
+ * given port. If none exists, this call returns null.
+ */
+ public synchronized UndertowServerEngine retrieveHttpServerEngine(int port)
+ {
+ UndertowServerEngine engine = null;
+ synchronized(portMap)
+ {
+ engine = portMap.get(port);
+ }
+ return engine;
+ }
+
+ public synchronized UndertowServerEngine createHttpServerEngine(String host, int port, String protocol)
+ throws IOException
+ {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Creating HttpServer Engine for port " + port + ".");
+ }
+ UndertowServerEngine ref = null;
+ synchronized(portMap)
+ {
+ ref = retrieveHttpServerEngine(port);
+ if (null == ref)
+ {
+ ref = new UndertowServerEngine(this, bus, host, port);
+ portMap.put(port, ref);
+ }
+ // checking the protocol
+ if (!protocol.equals(ref.getProtocol()))
+ {
+ throw new IOException("Protocol mismatch for port " + port + ": " + "engine's protocol is "
+ + ref.getProtocol() + ", the url protocol is " + protocol);
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * This method removes the Server Engine from the port map and stops it.
+ */
+ public synchronized void destroyForPort(int port)
+ {
+ synchronized(portMap)
+ {
+ UndertowServerEngine ref = portMap.remove(port);
+ if (ref != null)
+ {
+ if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine("Stopping HttpServer Engine on port " + port + ".");
+ }
+ try
+ {
+ ref.stop();
+ }
+ catch (Exception e)
+ {
+ LOG.log(Level.WARNING, "", e);
+ }
+ }
+ }
+ }
+
+ public void initComplete()
+ {
+ // do nothing here
+ }
+
+ public synchronized void postShutdown()
+ {
+ // shut down the httpserver in the portMap
+ // To avoid the CurrentModificationException,
+ // do not use portMap.vaules directly
+ UndertowServerEngine[] engines = null;
+ synchronized (portMap) {
+ engines = portMap.values().toArray(new UndertowServerEngine[0]);
+ }
+ for (UndertowServerEngine engine : engines)
+ {
+ if (engine.getBus() == getBus())
+ {
+ engine.shutdown();
+ }
+ }
+ }
+
+ public void preShutdown()
+ {
+ // do nothing here
+ }
+}
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/resources/META-INF/cxf/bus-extensions.txt
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/resources/META-INF/cxf/bus-extensions.txt (rev 0)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/resources/META-INF/cxf/bus-extensions.txt 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1 @@
+org.jboss.wsf.stack.cxf.addons.transports.undertow.UndertowServerDestinationFactory::true
\ No newline at end of file
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/resources/META-INF/cxf/bus-extensions.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java
===================================================================
--- stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java (rev 0)
+++ stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,222 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.wsf.stack.cxf.addons.transports.undertow;
+
+import io.undertow.server.HttpServerExchange;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.configuration.spring.ConfigurerImpl;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+import org.jboss.wsf.stack.cxf.addons.transports.undertow.UndertowServerEngine;
+import org.jboss.wsf.stack.cxf.addons.transports.undertow.UndertowServerEngineFactory;
+
+/**
+ * Tests for HttpServerEngine
+ *
+ * @author Magesh Kumar B <mageshbk(a)jboss.com> (C) 2011 Red Hat Inc.
+ * @author alessio.soldano(a)jboss.com
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ * @since 20-Aug-2010
+ *
+ */
+public class UndertowServerEngineTest extends TestCase {
+
+ private static final int THREAD_COUNT = 50;
+ private Bus bus;
+ private IMocksControl control;
+ private UndertowServerEngineFactory factory;
+ private static List<UndertowServerEngine> servers = Collections.synchronizedList(new ArrayList<UndertowServerEngine>());
+
+
+ public void setUp() throws Exception
+ {
+ control = EasyMock.createNiceControl();
+ bus = control.createMock(Bus.class);
+ Configurer configurer = new ConfigurerImpl();
+ bus.getExtension(Configurer.class);
+ EasyMock.expectLastCall().andReturn(configurer).anyTimes();
+ }
+
+ public void testEngineRetrieval() throws Exception
+ {
+ control.replay();
+ factory = new UndertowServerEngineFactory(bus);
+ UndertowServerEngine engine = factory.createHttpServerEngine("localhost", 9234, "http");
+ assertTrue(engine == factory.retrieveHttpServerEngine(9234));
+ factory.destroyForPort(1234);
+ control.verify();
+ }
+
+ public void testHttpAndHttps() throws Exception
+ {
+ control.replay();
+ factory = new UndertowServerEngineFactory(bus);
+ UndertowServerEngine engine = factory.createHttpServerEngine("localhost", 9234, "http");
+ assertTrue("http".equals(engine.getProtocol()));
+ System.out.println("[JBWS-3079] FIXME: Add support for https protocol");
+ //UndertowServerEngine engine2 = factory.createHttpServerEngine("localhost", 9235, "https");
+ //assertTrue("https".equals(engine2.getProtocol()));
+ factory.destroyForPort(9234);
+ //factory.destroyForPort(9235);
+
+ control.verify();
+ }
+
+ public void testMultiThreaded()
+ {
+ Thread threads[] = new Thread[THREAD_COUNT];
+ int i = 0;
+ // Initialize the threads
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ threads[i] = new Thread(new FactoryInvoker());
+ }
+ // Start the threads
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ threads[i].start();
+ }
+ // Wait for all threads to complete
+ while (servers.size() != THREAD_COUNT) {
+ try
+ {
+ Thread.sleep(100);
+ }
+ catch (InterruptedException ie)
+ {
+ // Ignore
+ }
+ }
+
+ UndertowServerEngine sharedEngine = servers.get(0);
+ for (UndertowServerEngine engine : servers)
+ {
+ assertEquals(sharedEngine, engine);
+ }
+ }
+
+ public void testHandler() throws Exception
+ {
+ MyTestHandler handler1 = new MyTestHandler();
+ MyTestHandler handler2 = new MyTestHandler();
+ control.replay();
+ factory = new UndertowServerEngineFactory(bus);
+ String urlStr1 = "http://localhost:9234/hello/test";
+ String urlStr2 = "http://localhost:9234/hello233/test";
+ UndertowServerEngine engine = factory.createHttpServerEngine("localhost", 9234, "http");
+ engine.addHandler(urlStr1, handler1);
+ engine.addHandler(urlStr2, handler2);
+ pingServer(new URL(urlStr1));
+ pingServer(new URL(urlStr2));
+ assertEquals(1, handler1.count.get());
+ assertEquals(1, handler2.count.get());
+ engine.removeHandler(urlStr1);
+ engine.removeHandler(urlStr2);
+ engine.shutdown();
+ factory.destroyForPort(9234);
+
+ control.verify();
+ }
+
+ private void pingServer(URL url)
+ {
+ try
+ {
+ HttpURLConnection connection1 = (HttpURLConnection) url.openConnection();
+ connection1.getInputStream();
+ connection1.disconnect();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private class MyTestHandler implements io.undertow.server.HttpHandler
+ {
+ AtomicInteger count = new AtomicInteger(0);
+
+ public MyTestHandler()
+ {
+
+ }
+
+
+ @Override
+ public void handleRequest(HttpServerExchange exchange) throws Exception
+ {
+ count.incrementAndGet();
+ exchange.setResponseCode(200);
+ OutputStream os = exchange.getOutputStream();
+ os.write("Hello".getBytes());
+ os.flush();
+
+ }
+ }
+
+ private class FactoryInvoker implements Runnable
+ {
+ private UndertowServerEngineFactory _factory;
+
+ FactoryInvoker()
+ {
+ _factory = new UndertowServerEngineFactory(null);
+ }
+
+ public void run()
+ {
+ UndertowServerEngine engine = null;
+ try
+ {
+ // Delay makes sure the try blocks are initialized before calling createHttpServerEngine,
+ // enhances the chance to enter the createHttpServerEngine simultaneously.
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch (InterruptedException ie)
+ {
+ // Ignore
+ }
+ engine = _factory.createHttpServerEngine("127.0.0.1", 18001, "http");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ servers.add(engine);
+ }
+ }
+}
Property changes on: stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/dist/pom.xml
===================================================================
--- stack/cxf/trunk/modules/dist/pom.xml 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/dist/pom.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -30,6 +30,12 @@
<dependency>
<groupId>org.jboss.ws.cxf</groupId>
+ <artifactId>jbossws-cxf-transports-undertow</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ws.cxf</groupId>
<artifactId>jbossws-cxf-transports-udp</artifactId>
<version>${project.version}</version>
</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 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/dist/src/main/scripts/assembly-deploy-artifacts.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -33,11 +33,14 @@
<include>org.jboss.ws.cxf:jbossws-cxf-factories:jar</include>
<include>org.jboss.ws.cxf:jbossws-cxf-server:jar</include>
<include>org.jboss.ws.cxf:jbossws-cxf-transports-httpserver:jar</include>
+ <include>org.jboss.ws.cxf:jbossws-cxf-transports-undertow:jar</include>
<include>org.jboss.ws.cxf:jbossws-cxf-transports-udp:jar</include>
<include>org.jboss.ws.native:jbossws-native-core:jar</include>
<include>org.jboss.ws.native:jbossws-native-services:jar</include>
<include>org.jboss.ws.projects:jaxws-jboss-httpserver-httpspi:jar</include>
+ <include>org.jboss.ws.projects:jaxws-undertow-httpspi:jar</include>
<include>org.jboss.com.sun.httpserver:httpserver:jar</include>
+ <include>io.undertow:undertow-core:jar</include>
<include>org.apache.cxf:cxf-*</include>
<include>org.apache.cxf.services.sts:cxf-services-sts-core:jar</include>
<include>org.apache.cxf.services.ws-discovery:cxf-services-ws-discovery-api:jar</include>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/as/webservices/server/integration/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/as/webservices/server/integration/main/module.xml 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/as/webservices/server/integration/main/module.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -50,7 +50,7 @@
</exports>
</module>
<module name="org.jboss.ws.cxf.jbossws-cxf-factories" services="export" export="true"/>
- <module name="org.jboss.ws.cxf.jbossws-cxf-transports-httpserver" export="true">
+ <module name="org.jboss.ws.cxf.jbossws-cxf-transports-undertow" export="true">
<imports>
<include path="META-INF/cxf"/>
<include path="META-INF"/>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-client/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-client/main/module.xml 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-client/main/module.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -44,7 +44,7 @@
<module name="org.jboss.ws.cxf.jbossws-cxf-factories" services="export" />
<!-- Apache CXF APIs only -->
<module name="org.apache.cxf" export="true" />
- <module name="org.jboss.ws.cxf.jbossws-cxf-transports-httpserver" export="true" services="export" />
+ <module name="org.jboss.ws.cxf.jbossws-cxf-transports-undertow" export="true" services="export" />
<module name="org.jboss.ws.cxf.jbossws-cxf-transports-udp" export="true" services="export" />
<module name="org.jboss.jaxbintros" export="true"/>
</dependencies>
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-server/main/module.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -52,7 +52,7 @@
<include path="META-INF"/>
</imports>
</module>
- <module name="org.jboss.ws.cxf.jbossws-cxf-transports-httpserver" services="import">
+ <module name="org.jboss.ws.cxf.jbossws-cxf-transports-undertow" services="import">
<imports>
<include path="META-INF/cxf"/> <!-- required to also pull in the bus extensions from META-INF -->
<include path="META-INF"/>
Added: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-transports-undertow/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-transports-undertow/main/module.xml (rev 0)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-transports-undertow/main/module.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,49 @@
+<?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.1" name="org.jboss.ws.cxf.jbossws-cxf-transports-undertow">
+
+ <properties>
+ <property name="jboss.api" value="private"/>
+ </properties>
+
+ <resources>
+ <!-- Insert resources here -->
+ </resources>
+
+ <dependencies>
+ <module name="org.jboss.ws.spi" />
+ <module name="org.jboss.ws.common" />
+ <module name="javax.annotation.api" />
+ <module name="javax.xml.ws.api" />
+ <module name="org.jboss.ws.jaxws-undertow-httpspi" />
+ <module name="org.apache.cxf.impl" services="import">
+ <imports>
+ <include path="META-INF/cxf"/> <!-- required to also pull in the bus extensions from META-INF -->
+ <include path="META-INF"/>
+ </imports>
+ </module>
+ <module name="io.undertow.core"/>
+ </dependencies>
+</module>
Property changes on: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/cxf/jbossws-cxf-transports-undertow/main/module.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-client/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-client/main/module.xml 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-client/main/module.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -49,7 +49,7 @@
<include path="META-INF"/>
</imports>
</module>
- <module name="org.jboss.ws.cxf.jbossws-cxf-transports-httpserver" services="import">
+ <module name="org.jboss.ws.cxf.jbossws-cxf-transports-undertow" services="import">
<imports>
<include path="META-INF/cxf"/> <!-- required to also pull in the bus extensions from META-INF -->
<include path="META-INF"/>
Added: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-undertow-httpspi/main/module.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-undertow-httpspi/main/module.xml (rev 0)
+++ stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-undertow-httpspi/main/module.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2010, 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.1" name="org.jboss.ws.jaxws-undertow-httpspi">
+
+ <properties>
+ <property name="jboss.api" value="private"/>
+ </properties>
+
+ <resources>
+ <!-- Insert resources here -->
+ </resources>
+
+ <dependencies>
+ <module name="javax.xml.ws.api" />
+ <module name="io.undertow.core"/>
+ </dependencies>
+</module>
Property changes on: stack/cxf/trunk/modules/resources/src/main/resources/modules/wildfly800/org/jboss/ws/jaxws-undertow-httpspi/main/module.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -40,9 +40,9 @@
<include name="**/jbossws-cxf-client.jar"/>
</fileset>
</copy>
- <copy todir="@{targetdir}/org/jboss/ws/jaxws-jboss-httpserver-httpspi/main" flatten="false" overwrite="true">
+ <copy todir="@{targetdir}/org/jboss/ws/jaxws-undertow-httpspi/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
- <include name="**/jaxws-jboss-httpserver-httpspi.jar"/>
+ <include name="**/jaxws-undertow-httpspi.jar"/>
</fileset>
</copy>
<copy todir="@{targetdir}/org/jboss/ws/cxf/jbossws-cxf-server/main" flatten="false" overwrite="true">
@@ -55,9 +55,9 @@
<include name="**/jbossws-cxf-factories.jar"/>
</fileset>
</copy>
- <copy todir="@{targetdir}/org/jboss/ws/cxf/jbossws-cxf-transports-httpserver/main" flatten="false" overwrite="true">
+ <copy todir="@{targetdir}/org/jboss/ws/cxf/jbossws-cxf-transports-undertow/main" flatten="false" overwrite="true">
<fileset dir="@{thirdpartydir}/lib">
- <include name="**/jbossws-cxf-transports-httpserver.jar"/>
+ <include name="**/jbossws-cxf-transports-undertow.jar"/>
</fileset>
</copy>
<copy todir="@{targetdir}/org/jboss/ws/cxf/jbossws-cxf-transports-udp/main" flatten="false" overwrite="true">
Modified: stack/cxf/trunk/modules/resources/src/main/resources/resources/modules-deploy.conf
===================================================================
--- stack/cxf/trunk/modules/resources/src/main/resources/resources/modules-deploy.conf 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/modules/resources/src/main/resources/resources/modules-deploy.conf 2014-01-15 10:00:35 UTC (rev 18239)
@@ -1 +1 @@
-org/apache/cxf/**, org/apache/neethi/**, org/apache/ws/commons/xmlschema/**, org/jboss/ws/cxf/**, org/jboss/ws/api/**, org/jboss/ws/common/**, org/jboss/ws/jaxws-client/**, org/jboss/ws/jaxws-jboss-httpserver-httpspi/**, org/jboss/ws/saaj-impl/**, org/jboss/ws/spi/**, org/jboss/ws/tools/**, org/opensaml/**, org/springframework/spring/**, org/jboss/ws/native/**
\ No newline at end of file
+org/apache/cxf/**, org/apache/neethi/**, org/apache/ws/commons/xmlschema/**, org/jboss/ws/cxf/**, org/jboss/ws/api/**, org/jboss/ws/common/**, org/jboss/ws/jaxws-client/**, org/jboss/ws/jaxws-jboss-httpserver-httpspi/**, org/jboss/ws/jaxws-undertow-httpspi/**,org/jboss/ws/saaj-impl/**, org/jboss/ws/spi/**, org/jboss/ws/tools/**, org/opensaml/**, org/springframework/spring/**, org/jboss/ws/native/**
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2014-01-15 06:23:18 UTC (rev 18238)
+++ stack/cxf/trunk/pom.xml 2014-01-15 10:00:35 UTC (rev 18239)
@@ -79,7 +79,9 @@
<picketbox.version>4.0.17.Final</picketbox.version>
<picketlink.version>2.1.7.Final</picketlink.version>
<jaxws-jboss-httpserver-httpspi.version>1.0.1.GA</jaxws-jboss-httpserver-httpspi.version>
+ <jaxws-undertow-httpspi.version>1.0.0-SNAPSHOT</jaxws-undertow-httpspi.version>
<httpserver.version>1.0.0.Final</httpserver.version>
+ <io.undertow.version>1.0.0.Beta30</io.undertow.version>
<jaxb.api.version>1.0.4.Final</jaxb.api.version>
<jaxb.impl.version>2.2.5</jaxb.impl.version>
<jaxrpc.api.version>1.0.1.Final</jaxrpc.api.version>
@@ -152,6 +154,11 @@
<artifactId>jaxws-jboss-httpserver-httpspi</artifactId>
<version>${jaxws-jboss-httpserver-httpspi.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.ws.projects</groupId>
+ <artifactId>jaxws-undertow-httpspi</artifactId>
+ <version>${jaxws-undertow-httpspi.version}</version>
+ </dependency>
<!-- CXF dependencies -->
<dependency>
@@ -946,6 +953,17 @@
<version>${httpserver.version}</version>
</dependency>
<dependency>
+ <groupId>io.undertow</groupId>
+ <artifactId>undertow-core</artifactId>
+ <version>${io.undertow.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>io.undertow</groupId>
+ <artifactId>undertow-build-config</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<version>${opensaml.version}</version>
10 years, 11 months
JBossWS SVN: r18238 - in projects/jaxws-undertow-httpspi/trunk/src: main/java/org/jboss/ws/undertow_httpspi and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: jim.ma
Date: 2014-01-15 01:23:18 -0500 (Wed, 15 Jan 2014)
New Revision: 18238
Added:
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/PathUtils.java
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowContextFactory.java
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHeaderMap.java
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpContext.java
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpExchange.java
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpHandler.java
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowServer.java
projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/
projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHRequest.java
projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHResponse.java
projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointAPITest.java
projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointBean.java
projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointInterface.java
projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/PathUtilsTest.java
Removed:
projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/
projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/
Log:
Refactor the package and class name after this impl is moved to a standalone project
Added: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/PathUtils.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/PathUtils.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/PathUtils.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.undertow_httpspi;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
+public class PathUtils
+{
+ /**
+ * Get the final path section of an address (for servlet
+ * container, this is typically a url-pattern for an endpoint)
+ *
+ * @param addr
+ * @return
+ */
+ public static String getPath(String addr)
+ {
+ return getPathInternal(getPathFromString(addr));
+ }
+
+ public static String getPath(URI addr)
+ {
+ return getPathInternal(addr.getPath());
+ }
+
+ public static String getPathFromRequest(String requestPath)
+ {
+ return getPathInternal(requestPath);
+ }
+
+ private static String getPathInternal(String rawpath)
+ {
+ String path = removeTrailingSlash(rawpath);
+ if (path == null || path.length() == 0)
+ {
+ return path;
+ }
+ int idx = path.lastIndexOf("/");
+ return idx > 0 ? path.substring(path.lastIndexOf("/")) : "";
+ }
+
+ /**
+ * Get the context path section of an address
+ *
+ * @param addr
+ * @return
+ */
+ public static String getContextPath(String addr)
+ {
+ return getContextPathInternal(getPathFromString(addr));
+ }
+
+ public static String getContextPathFromRequest(String requestPath)
+ {
+ return getContextPathInternal(requestPath);
+ }
+
+ public static String getContextPath(URI addr)
+ {
+ return getContextPathInternal(addr.getPath());
+ }
+
+ private static String getContextPathInternal(String rawpath)
+ {
+ String path = removeTrailingSlash(rawpath);
+ if (path == null || path.length() == 0)
+ {
+ return "/";
+ }
+ int idx = path.lastIndexOf("/");
+ return idx > 0 ? path.substring(0, idx) : path;
+ }
+
+ private static String getPathFromString(String addr)
+ {
+ String path = null;
+ try
+ {
+ path = new URL(addr).getPath();
+ }
+ catch (MalformedURLException e)
+ {
+ //ignore
+ }
+ return path;
+ }
+
+ public static String removeTrailingSlash(String path)
+ {
+ if (path != null && path.length() > 0 && path.lastIndexOf('/') == path.length() - 1)
+ {
+ path = path.substring(0, path.length() - 1);
+ }
+ return path;
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/PathUtils.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowContextFactory.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowContextFactory.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowContextFactory.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.undertow_httpspi;
+
+import javax.xml.ws.spi.http.HttpContext;
+
+/**
+ * A factory for building httpcontext based on undertow
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Aug-2010
+ *
+ */
+public class UndertowContextFactory
+{
+ public static HttpContext createHttpContext(UndertowServer server, String contextPath, String path)
+ {
+ return new UndertowHttpContext(server.getPathHandler(), contextPath, path);
+ }
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowContextFactory.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHeaderMap.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHeaderMap.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHeaderMap.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,208 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.undertow_httpspi;
+
+import io.undertow.util.HeaderMap;
+import io.undertow.util.HeaderValues;
+import io.undertow.util.HttpString;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+
+public class UndertowHeaderMap implements Map<String, List<String>>
+{
+
+ private HeaderMap headerMap;
+
+ public UndertowHeaderMap(HeaderMap headerMap) {
+ this.headerMap = headerMap;
+ }
+
+ @Override
+ public int size()
+ {
+ return headerMap.size();
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return headerMap.size() > 0;
+ }
+
+ @Override
+ public boolean containsKey(Object key)
+ {
+ return headerMap.contains(key.toString());
+ }
+
+ @Override
+ public boolean containsValue(Object value)
+ {
+ Iterator<HeaderValues> ite = headerMap.iterator();
+ while (ite.hasNext())
+ {
+ HeaderValues values = ite.next();
+ if (values.contains(value))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public List<String> get(Object key)
+ {
+ HeaderValues values = headerMap.get(key.toString());
+ List<String> result = new ArrayList<String>();
+ if (values != null)
+ {
+ for (String value : values.toArray())
+ {
+ result.add(value);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public List<String> put(String key, List<String> value)
+ {
+ List<String> previous = get(key);
+ if (previous.isEmpty())
+ {
+ previous = null;
+ }
+ headerMap.addAll(new HttpString(key), value);
+ return previous;
+
+ }
+
+ @Override
+ public List<String> remove(Object key)
+ {
+ List<String> previous = get(key);
+ if (previous.isEmpty())
+ {
+ previous = null;
+ }
+ headerMap.remove(key.toString());
+ return previous;
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ? extends List<String>> m)
+ {
+ for (String key : m.keySet())
+ {
+ headerMap.putAll(new HttpString(key), m.get(key));
+ }
+
+ }
+
+ @Override
+ public void clear()
+ {
+ headerMap.clear();
+
+ }
+
+ @Override
+ public Set<String> keySet()
+ {
+ Set<String> result = new HashSet<String>();
+ for (HeaderValues value : headerMap)
+ {
+ result.add(value.getHeaderName().toString());
+ }
+ return result;
+ }
+
+ @Override
+ public Collection<List<String>> values()
+ {
+ List<List<String>> collections = new ArrayList<List<String>>();
+ for (HeaderValues value : headerMap)
+ {
+ List<String> values = new ArrayList<String>();
+ for (String headerValue : value)
+ {
+ values.add(headerValue);
+ }
+ collections.add(values);
+ }
+ return collections;
+ }
+
+ @Override
+ public Set<java.util.Map.Entry<String, List<String>>> entrySet()
+ {
+ Set<java.util.Map.Entry<String, List<String>>> result = new HashSet<java.util.Map.Entry<String, List<String>>>();
+ for (HeaderValues headerValues : headerMap)
+ {
+ final String key = headerValues.getHeaderName().toString();
+ final List<String> headerValueList = new ArrayList<String>();
+ for (String value : headerValues)
+ {
+ headerValueList.add(value);
+ }
+ result.add(new Entry<String, List<String>>() {
+
+ @Override
+ public String getKey()
+ {
+ return key;
+ }
+
+ @Override
+ public List<String> getValue()
+ {
+ return headerValueList;
+ }
+
+ @Override
+ public List<String> setValue(List<String> value)
+ {
+ List<String> previous = headerMap.get(key);
+ if (previous.isEmpty())
+ {
+ previous = null;
+ }
+ headerMap.addAll(new HttpString(key), value);
+
+ return previous;
+
+ }
+ });
+ }
+ return result;
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHeaderMap.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpContext.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpContext.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpContext.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.undertow_httpspi;
+
+import io.undertow.server.handlers.PathHandler;
+
+import java.util.Set;
+
+import javax.xml.ws.spi.http.HttpContext;
+import javax.xml.ws.spi.http.HttpHandler;
+
+/**
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+//TODO:Look at HttpHandlerImpl - avoid to create duplicate UndertowHttpContext to publish endpoint
+public class UndertowHttpContext extends HttpContext
+{
+ private String handlerpath;
+ private PathHandler pathHandler;
+ private String path;
+
+ public UndertowHttpContext(PathHandler pathHandler, String contextPath, String path)
+ {
+ this.pathHandler = pathHandler;
+ this.path = path;
+ this.handlerpath = contextPath + path;
+ }
+
+ @Override
+ public void setHandler(HttpHandler handler)
+ {
+ pathHandler.addExactPath(handlerpath, new UndertowHttpHandler(handler));
+ }
+
+ @Override
+ public String getPath()
+ {
+ return this.path;
+ }
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ // TODO
+ return null;
+ }
+
+ @Override
+ public Set<String> getAttributeNames()
+ {
+ // TODO
+ return null;
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpContext.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpExchange.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpExchange.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpExchange.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,209 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.undertow_httpspi;
+
+import io.undertow.server.HttpServerExchange;
+import io.undertow.server.handlers.PathHandler;
+import io.undertow.util.HeaderValues;
+import io.undertow.util.HttpString;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.security.Principal;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.ws.spi.http.HttpContext;
+import javax.xml.ws.spi.http.HttpExchange;
+
+/**
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class UndertowHttpExchange extends HttpExchange
+{
+ private HttpServerExchange undertowExchange;
+
+ private UndertowHttpContext context;
+
+ public UndertowHttpExchange(HttpServerExchange serverExchange)
+ {
+ undertowExchange = serverExchange;
+ }
+
+ @Override
+ public Map<String, List<String>> getRequestHeaders()
+ {
+ return new UndertowHeaderMap(undertowExchange.getRequestHeaders());
+ }
+
+ @Override
+ public String getRequestHeader(String name)
+ {
+ HeaderValues headerValues = undertowExchange.getRequestHeaders().get(name);
+ if (headerValues != null && headerValues.size() > 0)
+ {
+ String result = "";
+ for (String headerValue : headerValues)
+ {
+ result = result + headerValue;
+ }
+ return result;
+ }
+ return null;
+ }
+
+ @Override
+ public Map<String, List<String>> getResponseHeaders()
+ {
+ return new UndertowHeaderMap(undertowExchange.getResponseHeaders());
+ }
+
+ @Override
+ public void addResponseHeader(String name, String value)
+ {
+ undertowExchange.getResponseHeaders().add(new HttpString(name), value);
+
+ }
+
+ @Override
+ public String getRequestURI()
+ {
+ return undertowExchange.getRequestURI();
+ }
+
+ @Override
+ public String getContextPath()
+ {
+ return PathUtils.getContextPathFromRequest(undertowExchange.getRequestPath());
+ }
+
+ @Override
+ public String getRequestMethod()
+ {
+ return undertowExchange.getRequestMethod().toString();
+ }
+
+ @Override
+ public HttpContext getHttpContext()
+ {
+ if (context == null)
+ {
+ context = new UndertowHttpContext(new PathHandler(), PathUtils.getContextPathFromRequest(undertowExchange.getRequestPath()),
+ PathUtils.getPathFromRequest(undertowExchange.getRequestPath()));
+ }
+ return context;
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ undertowExchange.endExchange();
+ }
+
+ @Override
+ public InputStream getRequestBody() throws IOException
+ {
+ return undertowExchange.getInputStream();
+ }
+
+ @Override
+ public OutputStream getResponseBody() throws IOException
+ {
+ return undertowExchange.getOutputStream();
+ }
+
+ @Override
+ public void setStatus(int status)
+ {
+ undertowExchange.setResponseCode(status);
+
+ }
+
+ @Override
+ public InetSocketAddress getRemoteAddress()
+ {
+ return undertowExchange.getSourceAddress();
+ }
+
+ @Override
+ public InetSocketAddress getLocalAddress()
+ {
+ return undertowExchange.getDestinationAddress();
+ }
+
+ @Override
+ public String getProtocol()
+ {
+ return undertowExchange.getProtocol().toString();
+ }
+
+ @Override
+ public String getScheme()
+ {
+ return undertowExchange.getRequestScheme();
+ }
+
+ @Override
+ public String getPathInfo()
+ {
+ return undertowExchange.getRequestPath();
+ }
+
+ @Override
+ public String getQueryString()
+ {
+ return undertowExchange.getQueryString();
+ }
+
+ @Override
+ public Object getAttribute(String name)
+ {
+ // TODO
+ return null;
+ }
+
+ @Override
+ public Set<String> getAttributeNames()
+ {
+ // TODO
+ return null;
+ }
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ //TODO
+ return null;
+ }
+
+ @Override
+ public boolean isUserInRole(String role)
+ {
+ //TODO
+ return false;
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpExchange.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpHandler.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpHandler.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpHandler.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.undertow_httpspi;
+
+import io.undertow.server.HttpHandler;
+import io.undertow.server.HttpServerExchange;
+
+/**
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class UndertowHttpHandler implements HttpHandler
+{
+
+ private javax.xml.ws.spi.http.HttpHandler spihandler;
+
+ public UndertowHttpHandler(javax.xml.ws.spi.http.HttpHandler handler)
+ {
+ spihandler = handler;
+ }
+
+ @Override
+ public void handleRequest(HttpServerExchange exchange) throws Exception
+ {
+ spihandler.handle(new UndertowHttpExchange(exchange));
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowHttpHandler.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowServer.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowServer.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowServer.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, 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.undertow_httpspi;
+
+import io.undertow.Undertow;
+import io.undertow.Undertow.Builder;
+import io.undertow.server.handlers.BlockingHandler;
+import io.undertow.server.handlers.PathHandler;
+
+/**
+ * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
+ *
+ */
+public class UndertowServer
+{
+ private Builder builder;
+ private PathHandler pathHandler;
+ private Undertow undertow;
+
+ public UndertowServer(int port, String host)
+ {
+ builder = Undertow.builder().addListener(port, host);
+ pathHandler = new PathHandler();
+ }
+
+ public Builder getBuilder()
+ {
+ return builder;
+ }
+
+ public PathHandler getPathHandler()
+ {
+ return pathHandler;
+ }
+
+ public void start()
+ {
+ undertow = builder.setHandler(new BlockingHandler(pathHandler)).build();
+ undertow.start();
+ }
+
+ public void stop()
+ {
+ if (undertow != null)
+ {
+ undertow.stop();
+ }
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/main/java/org/jboss/ws/undertow_httpspi/UndertowServer.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHRequest.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHRequest.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHRequest.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.ws.undertow_httpspi;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "dataRequest", namespace = "http://org.apache.cxf/jaxws/endpoint/")
+public class DHRequest {
+
+ private DataHandler dataHandler;
+
+ public DHRequest() {
+ }
+
+ public DHRequest(DataHandler dataHandler) {
+ this.dataHandler = dataHandler;
+ }
+
+ @XmlMimeType("text/plain")
+ public DataHandler getDataHandler() {
+ return dataHandler;
+ }
+
+ public void setDataHandler(DataHandler dataHandler) {
+ this.dataHandler = dataHandler;
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHRequest.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHResponse.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHResponse.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHResponse.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.ws.undertow_httpspi;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(name = "dataResponse", namespace = "http://org.apache.cxf/jaxws/endpoint/")
+public class DHResponse {
+
+ private DataHandler dataHandler;
+
+ public DHResponse() {
+ }
+
+ public DHResponse(DataHandler dataHandler) {
+ this.dataHandler = dataHandler;
+ }
+
+ @XmlMimeType("text/plain")
+ public DataHandler getDataHandler() {
+ return dataHandler;
+ }
+
+ public void setDataHandler(DataHandler dataHandler) {
+ this.dataHandler = dataHandler;
+ }
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/DHResponse.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointAPITest.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointAPITest.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointAPITest.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,232 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.undertow_httpspi;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.MTOMFeature;
+import javax.xml.ws.spi.http.HttpContext;
+
+import org.jboss.ws.undertow_httpspi.UndertowContextFactory;
+import org.jboss.ws.undertow_httpspi.UndertowServer;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * A JAXWS 2.2 Endoint.publish(HttpContext context) API test
+ * using the JDK6 httpsever as underlying http container
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 22-Aug-2010
+ *
+ */
+public class EndpointAPITest extends Assert
+{
+
+ private static int currentPort = 9876;
+
+ private UndertowServer server;
+
+ @Before
+ public void setUp() throws IOException
+ {
+ currentPort++;
+ server = new UndertowServer(currentPort, "localhost");
+ }
+
+ @After
+ public void tearDown()
+ {
+ server.stop();
+ server = null;
+ }
+
+ @Test
+ public void testSingleEndpoint() throws Exception
+ {
+
+ String contextPath = "/ctxt";
+ String path = "/echo";
+ String address = "http://localhost:" + currentPort + contextPath + path;
+
+ HttpContext context = UndertowContextFactory.createHttpContext(server, contextPath, path);
+
+ Endpoint endpoint = Endpoint.create(new EndpointBean());
+ endpoint.publish(context); // Use httpserver context for publishing
+
+ server.start();
+
+ invokeEndpoint(address);
+
+ endpoint.stop();
+ }
+
+ @Test
+ public void testMultiplePublishSameAddress() throws Exception
+ {
+ server.start();
+ String contextPath = "/ctxt";
+ String path = "/echo";
+ for (int i = 0; i < 3; i++)
+ {
+ HttpContext ctx = UndertowContextFactory.createHttpContext(server, contextPath, path);
+ String address = "http://localhost:" + currentPort + contextPath + path;
+
+ Endpoint endpoint = Endpoint.create(new EndpointBean());
+ endpoint.publish(ctx); // Use httpserver context for publishing
+
+ invokeEndpoint(address);
+
+ endpoint.stop();
+ }
+ }
+
+ @Test
+ public void testMultipleEndpointsSameContext() throws Exception
+ {
+ server.start();
+ String contextPath = "/ctxt";
+ String path = "/echo";
+ int k = 3;
+ Endpoint[] endpoints = new Endpoint[k];
+ HttpContext[] contexts = new HttpContext[k];
+ String[] addresses = new String[k];
+ for (int i = 0; i < k; i++)
+ {
+ addresses[i] = "http://localhost:" + currentPort + contextPath + path + i;
+ contexts[i] = UndertowContextFactory.createHttpContext(server, contextPath, path + i);
+ endpoints[i] = Endpoint.create(new EndpointBean());
+ endpoints[i].publish(contexts[i]);
+ }
+ for (int i = 0; i < k; i++)
+ {
+ invokeEndpoint(addresses[i]);
+ }
+ for (int i = 0; i < k; i++)
+ {
+ endpoints[i].stop();
+ }
+ }
+
+ @Test
+ public void testMultipleEndpointsDifferentContexts() throws Exception
+ {
+ server.start();
+ String contextPath = "/ctxt";
+ String path = "/echo";
+ int k = 3;
+ Endpoint[] endpoints = new Endpoint[k];
+ HttpContext[] contexts = new HttpContext[k];
+ String[] addresses = new String[k];
+ for (int i = 0; i < k; i++)
+ {
+ addresses[i] = "http://localhost:" + currentPort + contextPath + i + path;
+ contexts[i] = UndertowContextFactory.createHttpContext(server, contextPath + i, path);
+ endpoints[i] = Endpoint.create(new EndpointBean());
+ endpoints[i].publish(contexts[i]);
+ }
+ for (int i = 0; i < k; i++)
+ {
+ invokeEndpoint(addresses[i]);
+ }
+ for (int i = 0; i < k; i++)
+ {
+ endpoints[i].stop();
+ }
+ }
+
+ private void invokeEndpoint(String publishURL) throws Exception
+ {
+ URL wsdlURL = new URL(publishURL + "?wsdl");
+ QName qname = new QName("http://org.apache.cxf/jaxws/endpoint/", "EndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ checkBasicInvocations(service);
+ checkMTOMInvocation(service);
+ }
+
+ private static void checkBasicInvocations(Service service)
+ {
+ EndpointInterface port = (EndpointInterface) service.getPort(EndpointInterface.class);
+ String helloWorld = "Hello world!";
+ assertEquals(0, port.getCount());
+ Object retObj = port.echo(helloWorld);
+ assertEquals(helloWorld, retObj);
+ assertEquals(1, port.getCount());
+ port.echo(helloWorld);
+ assertEquals(2, port.getCount());
+ try
+ {
+ port.getException();
+ fail("Exception expected!");
+ }
+ catch (Exception e)
+ {
+ assertEquals("Ooops", e.getMessage());
+ }
+ }
+
+ private static void checkMTOMInvocation(Service service) throws IOException
+ {
+ DataSource ds = new DataSource()
+ {
+ public String getContentType()
+ {
+ return "text/plain";
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ return new ByteArrayInputStream("some string".getBytes());
+ }
+
+ public String getName()
+ {
+ return "none";
+ }
+
+ public OutputStream getOutputStream() throws IOException
+ {
+ return null;
+ }
+ };
+ EndpointInterface port = (EndpointInterface) service.getPort(EndpointInterface.class, new MTOMFeature(true));
+ DataHandler dh = new DataHandler(ds);
+ DHResponse response = port.echoDataHandler(new DHRequest(dh));
+ assertNotNull(response);
+ Object content = response.getDataHandler().getContent();
+ assertEquals("Server data", content);
+ String contentType = response.getDataHandler().getContentType();
+ assertEquals("text/plain", contentType);
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointAPITest.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointBean.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointBean.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointBean.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.ws.undertow_httpspi;
+
+import java.io.IOException;
+
+import javax.activation.DataHandler;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.MTOM;
+
+@WebService(serviceName = "EndpointService",
+ endpointInterface = "org.jboss.ws.undertow_httpspi.EndpointInterface",
+ targetNamespace = "http://org.apache.cxf/jaxws/endpoint/")
+@MTOM
+public class EndpointBean implements EndpointInterface {
+
+ private int count;
+ private boolean initialized;
+
+ public String echo(String input) {
+ count++;
+ return input;
+ }
+
+ @PostConstruct
+ public void init() {
+ this.initialized = true;
+ }
+
+ @PreDestroy
+ public void destroy() {
+ // nothing to do
+ }
+
+ public int getCount() {
+ this.ensureInit();
+ return count;
+ }
+
+ public void getException() {
+ this.ensureInit();
+ throw new WebServiceException("Ooops");
+ }
+
+ public DHResponse echoDataHandler(DHRequest request) {
+ this.ensureInit();
+ DataHandler dataHandler = request.getDataHandler();
+
+ try {
+ if (!dataHandler.getContentType().equals("text/plain")) {
+ throw new WebServiceException("Wrong content type");
+ }
+ if (!dataHandler.getContent().equals("some string")) {
+ throw new WebServiceException("Wrong data");
+ }
+ } catch (IOException e) {
+ throw new WebServiceException(e);
+ }
+
+ DataHandler responseData = new DataHandler("Server data", "text/plain");
+ return new DHResponse(responseData);
+ }
+
+ private void ensureInit() {
+ if (!this.initialized) {
+ throw new IllegalStateException();
+ }
+ }
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointBean.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointInterface.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointInterface.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointInterface.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.ws.undertow_httpspi;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(targetNamespace = "http://org.apache.cxf/jaxws/endpoint/")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface EndpointInterface {
+
+ String echo(String input);
+
+ int getCount();
+
+ void getException();
+
+ DHResponse echoDataHandler(DHRequest request);
+
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/EndpointInterface.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/PathUtilsTest.java
===================================================================
--- projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/PathUtilsTest.java (rev 0)
+++ projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/PathUtilsTest.java 2014-01-15 06:23:18 UTC (rev 18238)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.undertow_httpspi;
+
+import java.net.URI;
+
+import org.jboss.ws.undertow_httpspi.PathUtils;
+
+import junit.framework.TestCase;
+
+public class PathUtilsTest extends TestCase
+{
+ public void testPath() {
+ assertEquals("", PathUtils.getPath("http://localhost:8080"));
+ assertEquals("", PathUtils.getPath("http://localhost:8080/foo"));
+ assertEquals("", PathUtils.getPath("http://localhost:8080/foo/"));
+ assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/bar"));
+ assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/bar/"));
+ assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/bar?wsdl"));
+ assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/bar/?wsdl"));
+ assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/fooagain/bar"));
+ assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/fooagain/bar?wsdl"));
+ assertEquals("/bar", PathUtils.getPath("http://localhost:8080/foo/fooagain/bar?wsdl&xsd=ff"));
+ assertEquals("/bar", PathUtils.getPath("http://localhost/foo/bar"));
+ assertEquals("/bar", PathUtils.getPath("https://localhost/foo/bar"));
+
+ }
+
+ public void testContextPath() {
+ assertEquals("/", PathUtils.getContextPath("http://localhost:8080"));
+ assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo"));
+ assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/"));
+ assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/bar"));
+ assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/bar/"));
+ assertEquals("/foo/bar", PathUtils.getContextPath("http://localhost:8080/foo/bar/baragain"));
+ assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/bar?wsdl&xsd=kk"));
+ assertEquals("/foo", PathUtils.getContextPath("http://localhost:8080/foo/bar/?wsdl&xsd=kk"));
+ assertEquals("/foo", PathUtils.getContextPath("http://localhost/foo/bar"));
+ assertEquals("/foo", PathUtils.getContextPath("https://localhost/foo/bar"));
+ }
+
+ public void testURIPath() throws Exception {
+ assertEquals("", PathUtils.getPath(new URI("http", "", "localhost", 8080, "", "", "")));
+ assertEquals("", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo", "", "")));
+ assertEquals("", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/", "", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/bar", "", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/bar/", "", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/bar", "wsdl", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/bar/", "wsdl", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/fooagain/bar", "", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/fooagain/bar", "wsdl", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 8080, "/foo/fooagain/bar", "wsdl&xsd=ff", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("http", "", "localhost", 0, "/foo/bar", "", "")));
+ assertEquals("/bar", PathUtils.getPath(new URI("https", "", "localhost", 0, "/foo/bar", "", "")));
+ }
+
+ public void testURIContextPath() throws Exception {
+ assertEquals("/", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "", "", "")));
+ assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo", "", "")));
+ assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/", "", "")));
+ assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar", "", "")));
+ assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar/", "", "")));
+ assertEquals("/foo/bar", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar/baragain", "", "")));
+ assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar", "wsdl&xsd=kk", "")));
+ assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 8080, "/foo/bar/", "wsdl&xsd=kk", "")));
+ assertEquals("/foo", PathUtils.getContextPath(new URI("http", "", "localhost", 0, "/foo/bar", "", "")));
+ assertEquals("/foo", PathUtils.getContextPath(new URI("https", "", "localhost", 0, "/foo/bar", "", "")));
+ }
+}
Property changes on: projects/jaxws-undertow-httpspi/trunk/src/test/java/org/jboss/ws/undertow_httpspi/PathUtilsTest.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
10 years, 11 months
JBossWS SVN: r18237 - in projects/jaxws-httpserver-httpspi/trunk: src/main/java/org/jboss/ws/httpserver_httpspi and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-01-14 08:06:14 -0500 (Tue, 14 Jan 2014)
New Revision: 18237
Removed:
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHeaderMap.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpContext.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpExchange.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpHandler.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowServer.java
Modified:
projects/jaxws-httpserver-httpspi/trunk/pom.xml
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpContextDelegate.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpExchangeDelegate.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpHandlerDelegate.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpServerContextFactory.java
projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/PathUtils.java
projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointAPITest.java
Log:
[JBWS-3702] svn merge -r 18231:18230 .
Modified: projects/jaxws-httpserver-httpspi/trunk/pom.xml
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/pom.xml 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/pom.xml 2014-01-14 13:06:14 UTC (rev 18237)
@@ -30,7 +30,6 @@
<junit.version>4.8.1</junit.version>
<cxf.version>2.3.0</cxf.version>
<servlet-api.version>1.0.0.Beta2</servlet-api.version>
- <io.undertow.version>1.0.0.Beta30</io.undertow.version>
</properties>
<!-- Dependencies -->
@@ -40,19 +39,6 @@
<artifactId>jboss-jaxws-api_2.2_spec</artifactId>
<version>${jaxws.version}</version>
</dependency>
-
- <dependency>
- <groupId>io.undertow</groupId>
- <artifactId>undertow-core</artifactId>
- <version>${io.undertow.version}</version>
- <exclusions>
- <exclusion>
- <groupId>io.undertow</groupId>
- <artifactId>undertow-build-config</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<!-- test dependencies -->
<dependency>
Modified: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpContextDelegate.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpContextDelegate.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpContextDelegate.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -35,6 +35,7 @@
* @since 22-Aug-2010
*
*/
+@SuppressWarnings("restriction")
public class HttpContextDelegate extends HttpContext
{
private com.sun.net.httpserver.HttpContext delegate;
Modified: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpExchangeDelegate.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpExchangeDelegate.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpExchangeDelegate.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -45,6 +45,7 @@
* @since 22-Aug-2010
*
*/
+@SuppressWarnings("restriction")
public class HttpExchangeDelegate extends HttpExchange
{
private com.sun.net.httpserver.HttpExchange delegate;
Modified: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpHandlerDelegate.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpHandlerDelegate.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpHandlerDelegate.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -34,6 +34,7 @@
* @sine 22-Aug-2010
*
*/
+@SuppressWarnings("restriction")
public class HttpHandlerDelegate implements HttpHandler {
private javax.xml.ws.spi.http.HttpHandler delegate;
Modified: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpServerContextFactory.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpServerContextFactory.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/HttpServerContextFactory.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -21,10 +21,9 @@
*/
package org.jboss.ws.httpserver_httpspi;
+import com.sun.net.httpserver.HttpServer;
import javax.xml.ws.spi.http.HttpContext;
-import com.sun.net.httpserver.HttpServer;
-
/**
* A factory for building JDK6 httpserver' flavor of
*
@@ -32,15 +31,11 @@
* @since 22-Aug-2010
*
*/
+@SuppressWarnings("restriction")
public class HttpServerContextFactory
{
public static HttpContext createHttpContext(HttpServer server, String contextPath, String path)
{
return new HttpContextDelegate(server.createContext(contextPath + path), path);
}
-
- public static HttpContext createHttpContext(UndertowServer server, String contextPath, String path)
- {
- return new UndertowHttpContext(server.getPathHandler(), contextPath, path);
- }
}
Modified: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/PathUtils.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/PathUtils.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/PathUtils.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -44,11 +44,6 @@
return getPathInternal(addr.getPath());
}
- public static String getPathFromRequest(String requestPath)
- {
- return getPathInternal(requestPath);
- }
-
private static String getPathInternal(String rawpath)
{
String path = removeTrailingSlash(rawpath);
@@ -71,11 +66,6 @@
return getContextPathInternal(getPathFromString(addr));
}
- public static String getContextPathFromRequest(String requestPath)
- {
- return getContextPathInternal(requestPath);
- }
-
public static String getContextPath(URI addr)
{
return getContextPathInternal(addr.getPath());
@@ -106,7 +96,7 @@
return path;
}
- public static String removeTrailingSlash(String path)
+ private static String removeTrailingSlash(String path)
{
if (path != null && path.length() > 0 && path.lastIndexOf('/') == path.length() - 1)
{
Deleted: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHeaderMap.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHeaderMap.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHeaderMap.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -1,208 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2014, 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.httpserver_httpspi;
-
-import io.undertow.util.HeaderMap;
-import io.undertow.util.HeaderValues;
-import io.undertow.util.HttpString;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-
-
-public class UndertowHeaderMap implements Map<String, List<String>>
-{
-
- private HeaderMap headerMap;
-
- public UndertowHeaderMap(HeaderMap headerMap) {
- this.headerMap = headerMap;
- }
-
- @Override
- public int size()
- {
- return headerMap.size();
- }
-
- @Override
- public boolean isEmpty()
- {
- return headerMap.size() > 0;
- }
-
- @Override
- public boolean containsKey(Object key)
- {
- return headerMap.contains(key.toString());
- }
-
- @Override
- public boolean containsValue(Object value)
- {
- Iterator<HeaderValues> ite = headerMap.iterator();
- while (ite.hasNext())
- {
- HeaderValues values = ite.next();
- if (values.contains(value))
- {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public List<String> get(Object key)
- {
- HeaderValues values = headerMap.get(key.toString());
- List<String> result = new ArrayList<String>();
- if (values != null)
- {
- for (String value : values.toArray())
- {
- result.add(value);
- }
- }
- return result;
- }
-
- @Override
- public List<String> put(String key, List<String> value)
- {
- List<String> previous = get(key);
- if (previous.isEmpty())
- {
- previous = null;
- }
- headerMap.addAll(new HttpString(key), value);
- return previous;
-
- }
-
- @Override
- public List<String> remove(Object key)
- {
- List<String> previous = get(key);
- if (previous.isEmpty())
- {
- previous = null;
- }
- headerMap.remove(key.toString());
- return previous;
- }
-
- @Override
- public void putAll(Map<? extends String, ? extends List<String>> m)
- {
- for (String key : m.keySet())
- {
- headerMap.putAll(new HttpString(key), m.get(key));
- }
-
- }
-
- @Override
- public void clear()
- {
- headerMap.clear();
-
- }
-
- @Override
- public Set<String> keySet()
- {
- Set<String> result = new HashSet<String>();
- for (HeaderValues value : headerMap)
- {
- result.add(value.getHeaderName().toString());
- }
- return result;
- }
-
- @Override
- public Collection<List<String>> values()
- {
- List<List<String>> collections = new ArrayList<List<String>>();
- for (HeaderValues value : headerMap)
- {
- List<String> values = new ArrayList<String>();
- for (String headerValue : value)
- {
- values.add(headerValue);
- }
- collections.add(values);
- }
- return collections;
- }
-
- @Override
- public Set<java.util.Map.Entry<String, List<String>>> entrySet()
- {
- Set<java.util.Map.Entry<String, List<String>>> result = new HashSet<java.util.Map.Entry<String, List<String>>>();
- for (HeaderValues headerValues : headerMap)
- {
- final String key = headerValues.getHeaderName().toString();
- final List<String> headerValueList = new ArrayList<String>();
- for (String value : headerValues)
- {
- headerValueList.add(value);
- }
- result.add(new Entry<String, List<String>>() {
-
- @Override
- public String getKey()
- {
- return key;
- }
-
- @Override
- public List<String> getValue()
- {
- return headerValueList;
- }
-
- @Override
- public List<String> setValue(List<String> value)
- {
- List<String> previous = headerMap.get(key);
- if (previous.isEmpty())
- {
- previous = null;
- }
- headerMap.addAll(new HttpString(key), value);
-
- return previous;
-
- }
- });
- }
- return result;
- }
-
-}
Deleted: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpContext.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpContext.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpContext.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -1,75 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2014, 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.httpserver_httpspi;
-
-import io.undertow.server.handlers.PathHandler;
-
-import java.util.Set;
-
-import javax.xml.ws.spi.http.HttpContext;
-import javax.xml.ws.spi.http.HttpHandler;
-
-/**
- * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
- *
- */
-//TODO:Look at HttpHandlerImpl - avoid to create duplicate UndertowHttpContext to publish endpoint
-public class UndertowHttpContext extends HttpContext
-{
- private String handlerpath;
- private PathHandler pathHandler;
- private String path;
-
- public UndertowHttpContext(PathHandler pathHandler, String contextPath, String path)
- {
- this.pathHandler = pathHandler;
- this.path = path;
- this.handlerpath = contextPath + path;
- }
-
- @Override
- public void setHandler(HttpHandler handler)
- {
- pathHandler.addExactPath(handlerpath, new UndertowHttpHandler(handler));
- }
-
- @Override
- public String getPath()
- {
- return this.path;
- }
-
- @Override
- public Object getAttribute(String name)
- {
- // TODO
- return null;
- }
-
- @Override
- public Set<String> getAttributeNames()
- {
- // TODO
- return null;
- }
-
-}
Deleted: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpExchange.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpExchange.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpExchange.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -1,209 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2014, 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.httpserver_httpspi;
-
-import io.undertow.server.HttpServerExchange;
-import io.undertow.server.handlers.PathHandler;
-import io.undertow.util.HeaderValues;
-import io.undertow.util.HttpString;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.security.Principal;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.ws.spi.http.HttpContext;
-import javax.xml.ws.spi.http.HttpExchange;
-
-/**
- * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
- *
- */
-public class UndertowHttpExchange extends HttpExchange
-{
- private HttpServerExchange undertowExchange;
-
- private UndertowHttpContext context;
-
- public UndertowHttpExchange(HttpServerExchange serverExchange)
- {
- undertowExchange = serverExchange;
- }
-
- @Override
- public Map<String, List<String>> getRequestHeaders()
- {
- return new UndertowHeaderMap(undertowExchange.getRequestHeaders());
- }
-
- @Override
- public String getRequestHeader(String name)
- {
- HeaderValues headerValues = undertowExchange.getRequestHeaders().get(name);
- if (headerValues != null && headerValues.size() > 0)
- {
- String result = "";
- for (String headerValue : headerValues)
- {
- result = result + headerValue;
- }
- return result;
- }
- return null;
- }
-
- @Override
- public Map<String, List<String>> getResponseHeaders()
- {
- return new UndertowHeaderMap(undertowExchange.getResponseHeaders());
- }
-
- @Override
- public void addResponseHeader(String name, String value)
- {
- undertowExchange.getResponseHeaders().add(new HttpString(name), value);
-
- }
-
- @Override
- public String getRequestURI()
- {
- return undertowExchange.getRequestURI();
- }
-
- @Override
- public String getContextPath()
- {
- return PathUtils.getContextPathFromRequest(undertowExchange.getRequestPath());
- }
-
- @Override
- public String getRequestMethod()
- {
- return undertowExchange.getRequestMethod().toString();
- }
-
- @Override
- public HttpContext getHttpContext()
- {
- if (context == null)
- {
- context = new UndertowHttpContext(new PathHandler(), PathUtils.getContextPathFromRequest(undertowExchange.getRequestPath()),
- PathUtils.getPathFromRequest(undertowExchange.getRequestPath()));
- }
- return context;
- }
-
- @Override
- public void close() throws IOException
- {
- undertowExchange.endExchange();
- }
-
- @Override
- public InputStream getRequestBody() throws IOException
- {
- return undertowExchange.getInputStream();
- }
-
- @Override
- public OutputStream getResponseBody() throws IOException
- {
- return undertowExchange.getOutputStream();
- }
-
- @Override
- public void setStatus(int status)
- {
- undertowExchange.setResponseCode(status);
-
- }
-
- @Override
- public InetSocketAddress getRemoteAddress()
- {
- return undertowExchange.getSourceAddress();
- }
-
- @Override
- public InetSocketAddress getLocalAddress()
- {
- return undertowExchange.getDestinationAddress();
- }
-
- @Override
- public String getProtocol()
- {
- return undertowExchange.getProtocol().toString();
- }
-
- @Override
- public String getScheme()
- {
- return undertowExchange.getRequestScheme();
- }
-
- @Override
- public String getPathInfo()
- {
- return undertowExchange.getRequestPath();
- }
-
- @Override
- public String getQueryString()
- {
- return undertowExchange.getQueryString();
- }
-
- @Override
- public Object getAttribute(String name)
- {
- // TODO
- return null;
- }
-
- @Override
- public Set<String> getAttributeNames()
- {
- // TODO
- return null;
- }
-
- @Override
- public Principal getUserPrincipal()
- {
- //TODO
- return null;
- }
-
- @Override
- public boolean isUserInRole(String role)
- {
- //TODO
- return false;
- }
-
-}
Deleted: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpHandler.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpHandler.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowHttpHandler.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2014, 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.httpserver_httpspi;
-
-import io.undertow.server.HttpHandler;
-import io.undertow.server.HttpServerExchange;
-
-/**
- * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
- *
- */
-public class UndertowHttpHandler implements HttpHandler
-{
-
- private javax.xml.ws.spi.http.HttpHandler spihandler;
-
- public UndertowHttpHandler(javax.xml.ws.spi.http.HttpHandler handler)
- {
- spihandler = handler;
- }
-
- @Override
- public void handleRequest(HttpServerExchange exchange) throws Exception
- {
- spihandler.handle(new UndertowHttpExchange(exchange));
- }
-
-}
Deleted: projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowServer.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowServer.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/main/java/org/jboss/ws/httpserver_httpspi/UndertowServer.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2014, 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.httpserver_httpspi;
-
-import io.undertow.Undertow;
-import io.undertow.Undertow.Builder;
-import io.undertow.server.handlers.BlockingHandler;
-import io.undertow.server.handlers.PathHandler;
-
-/**
- * @author <a href="mailto:ema@redhat.com">Jim Ma</a>
- *
- */
-public class UndertowServer
-{
- private Builder builder;
- private PathHandler pathHandler;
- private Undertow undertow;
-
- public UndertowServer(int port, String host)
- {
- builder = Undertow.builder().addListener(port, host);
- pathHandler = new PathHandler();
- }
-
- public Builder getBuilder()
- {
- return builder;
- }
-
- public PathHandler getPathHandler()
- {
- return pathHandler;
- }
-
- public void start()
- {
- undertow = builder.setHandler(new BlockingHandler(pathHandler)).build();
- undertow.start();
- }
-
- public void stop()
- {
- if (undertow != null)
- {
- undertow.stop();
- }
- }
-
-}
Modified: projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointAPITest.java
===================================================================
--- projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointAPITest.java 2014-01-14 13:00:46 UTC (rev 18236)
+++ projects/jaxws-httpserver-httpspi/trunk/src/test/java/org/jboss/ws/httpserver_httpspi/EndpointAPITest.java 2014-01-14 13:06:14 UTC (rev 18237)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.InetSocketAddress;
import java.net.URL;
import javax.activation.DataHandler;
@@ -48,24 +49,25 @@
* @since 22-Aug-2010
*
*/
+@SuppressWarnings("restriction")
public class EndpointAPITest extends Assert
{
private static int currentPort = 9876;
- private UndertowServer server;
+ private com.sun.net.httpserver.HttpServer server;
@Before
public void setUp() throws IOException
{
currentPort++;
- server = new UndertowServer(currentPort, "localhost");
+ server = com.sun.net.httpserver.HttpServer.create(new InetSocketAddress(currentPort), 0);
}
@After
public void tearDown()
{
- server.stop();
+ server.stop(0);
server = null;
}
@@ -106,6 +108,7 @@
invokeEndpoint(address);
endpoint.stop();
+ server.removeContext(contextPath + path);
}
}
10 years, 11 months