cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1086254 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/ rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/ systests/jaxrs/src/...
Date Mon, 28 Mar 2011 14:31:19 GMT
Author: cschneider
Date: Mon Mar 28 14:31:19 2011
New Revision: 1086254

URL: http://svn.apache.org/viewvc?rev=1086254&view=rev
Log:
CXF-3419 Fixes for jaxrs test failures

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
    cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
    cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=1086254&r1=1086253&r2=1086254&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
Mon Mar 28 14:31:19 2011
@@ -272,7 +272,7 @@ public class CXFNonSpringJaxrsServlet ex
         
         String ignoreParam = servletConfig.getInitParameter(IGNORE_APP_PATH_PARAM);
         JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, MessageUtils.isTrue(ignoreParam));
-        
+        bean.setBus(getBus());
         bean.create();
     }
     

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?rev=1086254&r1=1086253&r2=1086254&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
Mon Mar 28 14:31:19 2011
@@ -18,6 +18,10 @@
  */
 package org.apache.cxf.transport.servlet;
 
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.management.RuntimeErrorException;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -50,17 +54,7 @@ public class CXFServlet extends Abstract
     public void init(ServletConfig sc) throws ServletException {
         super.init(sc);
         if (this.bus == null) {
-            ApplicationContext wac = WebApplicationContextUtils.
-                getWebApplicationContext(sc.getServletContext());
-            String configLocation = sc.getInitParameter("config-location");
-            if (wac == null && (configLocation != null)) {
-                wac = new ClassPathXmlApplicationContext(configLocation);
-            }
-            if (wac != null) {
-                this.bus = wac.getBean("cxf", Bus.class);
-            } else {
-                this.bus = BusFactory.newInstance().createBus();
-            }
+            loadBus(sc);
         }
 
         ResourceManager resourceManager = bus.getExtension(ResourceManager.class);
@@ -82,6 +76,25 @@ public class CXFServlet extends Abstract
         this.controller = createServletController(sc);
     }
 
+    private void loadBus(ServletConfig sc) {
+        ApplicationContext wac = WebApplicationContextUtils.
+            getWebApplicationContext(sc.getServletContext());
+        String configLocation = sc.getInitParameter("config-location");
+        if (wac == null && (configLocation != null)) {
+            try {
+                URL configUrl = sc.getServletContext().getResource(configLocation);
+                wac = new ClassPathXmlApplicationContext(configUrl.toExternalForm());
+            } catch (MalformedURLException e) {
+                throw new RuntimeException(e.getMessage(), e);
+            }
+        }
+        if (wac != null) {
+            this.bus = wac.getBean("cxf", Bus.class);
+        } else {
+            this.bus = BusFactory.newInstance().createBus();
+        }
+    }
+
     private ServletController createServletController(ServletConfig servletConfig) {
         HttpServlet serviceListGeneratorServlet = 
             new ServiceListGeneratorServlet(transportFactory.getRegistry(), bus);

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml?rev=1086254&r1=1086253&r2=1086254&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml Mon
Mar 28 14:31:19 2011
@@ -25,6 +25,7 @@ http://www.springframework.org/schema/be
 http://www.springframework.org/schema/beans/spring-beans.xsd
 http://cxf.apache.org/jaxrs
 http://cxf.apache.org/schemas/jaxrs.xsd">
+	<import resource="classpath:/META-INF/cxf/cxf.xml"/>
 
     <jaxrs:server id="bookservice"
                   address="/">

Modified: cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml?rev=1086254&r1=1086253&r2=1086254&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml (original)
+++ cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml Mon
Mar 28 14:31:19 2011
@@ -25,6 +25,7 @@ http://www.springframework.org/schema/be
 http://www.springframework.org/schema/beans/spring-beans.xsd
 http://cxf.apache.org/jaxrs
 http://cxf.apache.org/schemas/jaxrs.xsd">
+	<import resource="classpath:/META-INF/cxf/cxf.xml"/>
 
     <jaxrs:server id="bookservice"
                   address="/resources">



Mime
View raw message