cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1087029 - in /cxf/trunk/rt: ./ transports/http-osgi/ transports/http/src/main/java/org/apache/cxf/transport/servlet/ transports/http/src/main/resources/META-INF/cxf/ transports/http/src/main/resources/META-INF/spring/
Date Wed, 30 Mar 2011 18:02:10 GMT
Author: cschneider
Date: Wed Mar 30 18:02:10 2011
New Revision: 1087029

URL: http://svn.apache.org/viewvc?rev=1087029&view=rev
Log:
CXF-3419 Fixing osgi config for http, removing http-osgi project

Added:
    cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-osgi.xml
      - copied unchanged from r1086862, cxf/trunk/rt/transports/http-osgi/src/main/resources/META-INF/cxf/osgi/cxf-extension-osgi.xml
Removed:
    cxf/trunk/rt/transports/http-osgi/
Modified:
    cxf/trunk/rt/pom.xml
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
    cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml

Modified: cxf/trunk/rt/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/pom.xml?rev=1087029&r1=1087028&r2=1087029&view=diff
==============================================================================
--- cxf/trunk/rt/pom.xml (original)
+++ cxf/trunk/rt/pom.xml Wed Mar 30 18:02:10 2011
@@ -48,7 +48,6 @@
         <module>transports/common</module>
         <module>transports/http</module>
         <module>transports/http-jetty</module>
-        <module>transports/http-osgi</module>
         <module>transports/jms</module>
         <module>transports/jbi</module>
         <module>ws/policy</module>

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java?rev=1087029&r1=1087028&r2=1087029&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
Wed Mar 30 18:02:10 2011
@@ -30,19 +30,23 @@ import org.apache.cxf.BusFactory;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.transport.http.DestinationRegistry;
 import org.apache.cxf.transport.http.HTTPTransportFactory;
 import org.apache.cxf.transport.servlet.servicelist.ServiceListGeneratorServlet;
 
 public class CXFNonSpringServlet extends AbstractHTTPServlet {
 
-    private HTTPTransportFactory transportFactory;
+    private DestinationRegistry destinationRegistry;
     private Bus bus;
-
     private ServletController controller;
     
     public CXFNonSpringServlet() {
     }
 
+    public CXFNonSpringServlet(DestinationRegistry destinationRegistry) {
+        this.destinationRegistry = destinationRegistry;
+    }
+
     @Override
     public void init(ServletConfig sc) throws ServletException {
         super.init(sc);
@@ -54,30 +58,36 @@ public class CXFNonSpringServlet extends
         resourceManager.addResourceResolver(new ServletContextResourceResolver(
                                                sc.getServletContext()));
 
-        if (transportFactory == null) {
-            DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
-            try {
-                DestinationFactory df = dfm
-                    .getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
-                if (df instanceof HTTPTransportFactory) {
-                    transportFactory = (HTTPTransportFactory)df;
-                }
-            } catch (BusException e) {
-                // why are we throwing a busexception if the DF isn't found?
-            }
+        if (destinationRegistry == null) {
+            this.destinationRegistry = getDestinationRegistryFromBus(this.bus);
         }
         this.controller = createServletController(sc);
     }
 
+    private static DestinationRegistry getDestinationRegistryFromBus(Bus bus) {
+        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+        try {
+            DestinationFactory df = dfm
+                .getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
+            if (df instanceof HTTPTransportFactory) {
+                HTTPTransportFactory transportFactory = (HTTPTransportFactory)df;
+                return transportFactory.getRegistry();
+            }
+        } catch (BusException e) {
+            // why are we throwing a busexception if the DF isn't found?
+        }
+        return null;
+    }
+
     protected void loadBus(ServletConfig sc) {
         this.bus = BusFactory.newInstance().createBus();
     }
 
     private ServletController createServletController(ServletConfig servletConfig) {
         HttpServlet serviceListGeneratorServlet = 
-            new ServiceListGeneratorServlet(transportFactory.getRegistry(), bus);
+            new ServiceListGeneratorServlet(destinationRegistry, bus);
         ServletController newController =
-            new ServletController(transportFactory.getRegistry(),
+            new ServletController(destinationRegistry,
                                   servletConfig,
                                   serviceListGeneratorServlet);        
         return newController;

Modified: cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml?rev=1087029&r1=1087028&r2=1087029&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml (original)
+++ cxf/trunk/rt/transports/http/src/main/resources/META-INF/spring/osgiservlet.xml Wed Mar
30 18:02:10 2011
@@ -45,7 +45,7 @@ http://www.springframework.org/schema/co
 
     <bean id="destinationRegistry" class="org.apache.cxf.transport.http.DestinationRegistryImpl"
/>
 
-    <!--bean id="osgiServlet" class="org.apache.cxf.transport.servlet.CXFServlet">
+    <bean id="osgiServlet" class="org.apache.cxf.transport.servlet.CXFNonSpringServlet">
         <constructor-arg ref="destinationRegistry"/>
     </bean>
 
@@ -62,7 +62,7 @@ http://www.springframework.org/schema/co
             <entry key="redirect-servlet-name" value="${org.apache.cxf.servlet.redirect-servlet-name}"/>
             <entry key="redirect-servlet-path" value="${org.apache.cxf.servlet.redirect-servlet-path}"/>
         </osgi:service-properties>
-    </osgi:service-->
+    </osgi:service>
 
     <osgi:service ref="destinationRegistry" interface="org.apache.cxf.transport.http.DestinationRegistry">
     </osgi:service>



Mime
View raw message