cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r984862 - in /cxf/trunk/rt/frontend/jaxrs/src/main: java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml
Date Thu, 12 Aug 2010 16:50:48 GMT
Author: dkulp
Date: Thu Aug 12 16:50:47 2010
New Revision: 984862

URL: http://svn.apache.org/viewvc?rev=984862&view=rev
Log:
[CXF-2936] Change the registration of the JAXRS binding to be internal
to the factory.  Reduces the spring stuff as well as makes it so
it's NOT required to import the cxf-extension-jaxrs-binding.xml
file.

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java
    cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java?rev=984862&r1=984861&r2=984862&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
Thu Aug 12 16:50:47 2010
@@ -30,6 +30,8 @@ import java.util.logging.Logger;
 
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
+
+import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.BindingConfiguration;
 import org.apache.cxf.binding.BindingFactory;
@@ -86,6 +88,27 @@ public class AbstractJAXRSFactoryBean ex
         setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID);
     }
     
+    public Bus getBus() {
+        Bus b = super.getBus();
+        checkBindingFactory(bus);
+        return b;
+    }
+
+    private void checkBindingFactory(Bus bus) {
+        BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
+        try {
+            bfm.getBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID);
+        } catch (BusException b) {
+            //not registered, let's register one
+            bfm.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, 
+                                       new JAXRSBindingFactory(bus));
+        }
+    }
+
+    public void setBus(Bus bus) {
+        super.setBus(bus);
+        checkBindingFactory(bus);
+    }
     
     /*
      * EndpointInfo contains information form WSDL's physical part such as

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java?rev=984862&r1=984861&r2=984862&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSBindingFactory.java
Thu Aug 12 16:50:47 2010
@@ -19,6 +19,7 @@
 package org.apache.cxf.jaxrs;
 
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.binding.xml.XMLBinding;
@@ -38,6 +39,9 @@ public class JAXRSBindingFactory extends
 
     public JAXRSBindingFactory() {
     }
+    public JAXRSBindingFactory(Bus b) {
+        super(b);
+    }
 
     public Binding createBinding(BindingInfo bi) {
         XMLBinding binding = new XMLBinding(bi);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml?rev=984862&r1=984861&r2=984862&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml
Thu Aug 12 16:50:47 2010
@@ -23,15 +23,7 @@
        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">
-    
-    <bean class="org.apache.cxf.jaxrs.JAXRSBindingFactory" 
-	  id="org.apache.cxf.jaxrs.JAXRSBindingFactory" 
-	  lazy-init="true">
-        <property name="activationNamespaces">
-            <set>
-                <value>http://apache.org/cxf/binding/jaxrs</value>
-            </set>
-        </property>
-	<property name="bus" ref="cxf"/>
-    </bean>
+
+    <!-- Nothing needed now.  Leave file for 2.2.x for compatibility -->
+
 </beans>



Mime
View raw message