Author: alessio.soldano(a)jboss.com
Date: 2011-04-22 06:34:52 -0400 (Fri, 22 Apr 2011)
New Revision: 14184
Added:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestinationFactory.java
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.txt
Removed:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerTransportFactory.java
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.xml
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf-extension-httpserver.xml
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf.extension
Modified:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestination.java
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
Log:
Fixing http transport configuration: the httpserver destination creation now goes through
registration of HttpServerDestinationFactory that is then used by the CXF
HTTPTransportFactory
Modified:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestination.java
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestination.java 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestination.java 2011-04-22
10:34:52 UTC (rev 14184)
@@ -54,16 +54,14 @@
private static final long serialVersionUID = 1L;
- private HttpServerTransportFactory factory;
private HttpServerEngineFactory serverEngineFactory;
private HttpServerEngine engine;
private URL url;
- public HttpServerDestination(Bus b, DestinationRegistry registry,
HttpServerTransportFactory factory, EndpointInfo ei) throws IOException
+ public HttpServerDestination(Bus b, DestinationRegistry registry, EndpointInfo ei)
throws IOException
{
super(b, registry, ei);
- this.factory = factory;
- this.serverEngineFactory = factory.getServerEngineFactory();
+ this.serverEngineFactory = getServerEngineFactory();
getAddressValue(ei, true); //generate address if not specified
this.url = new URL(ei.getAddress());
}
@@ -94,6 +92,19 @@
+ engine.getProtocol() + "\" for \"" + url +
"\"");
}
}
+
+ protected HttpServerEngineFactory getServerEngineFactory()
+ {
+ HttpServerEngineFactory serverEngineFactory =
getBus().getExtension(HttpServerEngineFactory.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 HttpServerEngineFactory(bus);
+ }
+ return serverEngineFactory;
+ }
/**
* Activate receipt of incoming messages.
@@ -122,13 +133,6 @@
engine.removeHandler(endpointInfo.getAddress());
}
- @Override
- public void shutdown()
- {
- factory.removeDestination(endpointInfo);
- super.shutdown();
- }
-
class Handler extends HttpHandlerImpl implements HttpHandler
{
Added:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestinationFactory.java
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestinationFactory.java
(rev 0)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerDestinationFactory.java 2011-04-22
10:34:52 UTC (rev 14184)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.httpserver;
+
+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 HttpServerDestinationFactory implements HttpDestinationFactory
+{
+ @Override
+ public AbstractHTTPDestination createDestination(EndpointInfo endpointInfo, Bus bus,
DestinationRegistry registry)
+ throws IOException
+ {
+ return new HttpServerDestination(bus, registry, endpointInfo);
+ }
+}
Modified:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java 2011-04-22
10:34:52 UTC (rev 14184)
@@ -131,6 +131,7 @@
}
else
{
+ System.out.println("******* " + factory + " ******
handlerCount="+handlerCount);
LOG.log(Level.WARNING, "FAILED_TO_SHUTDOWN_ENGINE_MSG", port);
}
}
Modified:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java 2011-04-22
10:34:52 UTC (rev 14184)
@@ -140,7 +140,10 @@
HttpServerEngine[] engines = portMap.values().toArray(new HttpServerEngine[0]);
for (HttpServerEngine engine : engines)
{
- engine.shutdown();
+ if (engine.getBus() == getBus())
+ {
+ engine.shutdown();
+ }
}
}
Deleted:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerTransportFactory.java
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerTransportFactory.java 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerTransportFactory.java 2011-04-22
10:34:52 UTC (rev 14184)
@@ -1,118 +0,0 @@
-/*
- * 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.httpserver;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.Destination;
-import org.apache.cxf.transport.DestinationFactory;
-import org.apache.cxf.transport.http.HTTPTransportFactory;
-
-/**
- * A Destination/Transport factory for the JDK6 httpserver
- *
- * @author alessio.soldano(a)jboss.com
- * @since 19-Aug-2010
- *
- */
-public class HttpServerTransportFactory extends HTTPTransportFactory implements
DestinationFactory
-{
- private Map<String, HttpServerDestination> destinations = new
ConcurrentHashMap<String, HttpServerDestination>();
-
- public HttpServerTransportFactory()
- {
- super();
- }
-
- @Resource
- public void setBus(Bus b)
- {
- super.setBus(b);
- }
-
- @PostConstruct
- public void finalizeConfig()
- {
- if (null == bus)
- {
- return;
- }
- // This call will register the server engine factory
- // with the Bus.
- getServerEngineFactory();
- }
-
- protected HttpServerEngineFactory getServerEngineFactory()
- {
- HttpServerEngineFactory serverEngineFactory =
getBus().getExtension(HttpServerEngineFactory.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 HttpServerEngineFactory(bus);
- serverEngineFactory.setBus(getBus());
- }
- return serverEngineFactory;
- }
-
- public Destination getDestination(EndpointInfo endpointInfo) throws IOException
- {
- String addr = endpointInfo.getAddress();
- HttpServerDestination destination = addr == null ? null : destinations.get(addr);
- if (destination == null)
- {
- destination = createDestination(endpointInfo);
- }
- return destination;
- }
-
- private synchronized HttpServerDestination createDestination(EndpointInfo
endpointInfo) throws IOException
- {
- String addr = endpointInfo.getAddress();
- HttpServerDestination destination = addr == null ? null : destinations.get(addr);
- if (destination == null)
- {
- destination = new HttpServerDestination(getBus(), this.registry, this,
endpointInfo);
- destinations.put(endpointInfo.getAddress(), destination);
- configure(destination);
- destination.finalizeConfig();
- }
- return destination;
- }
-
- /**
- * This function removes the destination for a particular endpoint.
- */
- void removeDestination(EndpointInfo ei)
- {
- destinations.remove(ei.getAddress());
- }
-
-}
Added:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.txt
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.txt
(rev 0)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.txt 2011-04-22
10:34:52 UTC (rev 14184)
@@ -0,0 +1 @@
+org.jboss.wsf.stack.cxf.addons.transports.httpserver.HttpServerDestinationFactory::true
\ No newline at end of file
Deleted:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.xml
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.xml 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/bus-extensions.xml 2011-04-22
10:34:52 UTC (rev 14184)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<extensions
xmlns="http://cxf.apache.org/bus/extension">
-
- <extension
class="org.jboss.wsf.stack.cxf.addons.transports.httpserver.HttpServerTransportFactory"
deferred="false">
- <
namespace>http://cxf.apache.org/transports/http</namespace>
-
<
namespace>http://cxf.apache.org/transports/http/configuration</name...
- <
namespace>http://schemas.xmlsoap.org/wsdl/http</namespace>
- <
namespace>http://schemas.xmlsoap.org/wsdl/http/</namespace>
- </extension>
-</extensions>
Deleted:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf-extension-httpserver.xml
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf-extension-httpserver.xml 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf-extension-httpserver.xml 2011-04-22
10:34:52 UTC (rev 14184)
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans
xmlns="http://www.springframework.org/schema/beans"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xmlns:foo="http://cxf.apache.org/configuration/foo"
- xsi:schemaLocation="
-http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
-
- <bean
class="org.jboss.wsf.stack.cxf.addons.transports.httpserver.HttpServerTransportFactory"
-
id="org.jboss.wsf.stack.cxf.addons.transports.httpserver.HttpServerTransportFactory"
- lazy-init="true">
- <property name="bus" ref="cxf"/>
- <property name="transportIds">
- <list>
- <
value>http://cxf.apache.org/transports/http</value>
-
<
value>http://cxf.apache.org/transports/http/configuration</value>
- <
value>http://schemas.xmlsoap.org/wsdl/http</value>
- <
value>http://schemas.xmlsoap.org/wsdl/http/</value>
- </list>
- </property>
- </bean>
-
-</beans>
Deleted:
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf.extension
===================================================================
---
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf.extension 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/addons/transports/http/httpserver/src/main/resources/META-INF/cxf/cxf.extension 2011-04-22
10:34:52 UTC (rev 14184)
@@ -1 +0,0 @@
-META-INF/cxf/cxf-extension-httpserver.xml
\ No newline at end of file
Modified:
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
===================================================================
---
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2011-04-22
10:34:52 UTC (rev 14184)
@@ -28,16 +28,11 @@
import javax.xml.ws.soap.SOAPBinding;
import org.apache.cxf.binding.soap.SoapTransportFactory;
-import org.apache.cxf.bus.extension.ExtensionManager;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.resource.ResourceResolver;
import org.apache.cxf.service.invoker.Invoker;
-import org.apache.cxf.transport.ConduitInitiator;
-import org.apache.cxf.transport.DestinationFactory;
-import org.apache.cxf.transport.http.HTTPTransportFactory;
import org.apache.cxf.transport.http.HttpDestinationFactory;
import org.apache.cxf.transport.servlet.ServletDestinationFactory;
-//import org.apache.cxf.transport.servlet.ServletTransportFactory;
import org.apache.cxf.ws.addressing.WSAddressingFeature;
import org.apache.cxf.ws.rm.RMManager;
import org.jboss.wsf.spi.binding.BindingCustomization;
@@ -69,17 +64,8 @@
super();
this.metadata = metadata;
bus = new JBossWSNonSpringBusFactory().createBus();
- //Force servlet transport to prevent CXF from using Jetty or other transports
- new HTTPTransportFactory(bus);
+ //Force servlet transport to prevent CXF from using Jetty / http server or other
transports
bus.setExtension(new ServletDestinationFactory(), HttpDestinationFactory.class);
-// //Force servlet transport to prevent CXF from using Jetty or other transports
-// ExtensionManager em = bus.getExtension(ExtensionManager.class);
-// em.activateAllByType(ConduitInitiator.class); //need to activate/register all the
beans implementing ConduitInitiator so that does not happen later
-// DestinationFactory factory = new ServletTransportFactory(bus);
-// for (String s : factory.getTransportIds())
-// {
-// registerTransport(factory, s);
-// }
}
/**
Modified:
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
===================================================================
---
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2011-04-22
02:27:35 UTC (rev 14183)
+++
stack/cxf/branches/cxf24/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2011-04-22
10:34:52 UTC (rev 14184)
@@ -99,15 +99,8 @@
log.trace("Could not load additional config from location: " +
location, e);
}
}
- //Force servlet transport to prevent CXF from using Jetty or other transports
- new HTTPTransportFactory(bus);
+ //Force servlet transport to prevent CXF from using Jetty / http server or other
transports
bus.setExtension(new ServletDestinationFactory(), HttpDestinationFactory.class);
-// //Force servlet transport to prevent CXF from using Jetty or other transports
-// DestinationFactory factory = new ServletTransportFactory(bus);
-// for (String s : factory.getTransportIds())
-// {
-// registerTransport(factory, s);
-// }
}
/**