cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1101400 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/
Date Tue, 10 May 2011 10:55:43 GMT
Author: sergeyb
Date: Tue May 10 10:55:43 2011
New Revision: 1101400

URL: http://svn.apache.org/viewvc?rev=1101400&view=rev
Log:
Merged revisions 1101399 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1101399 | sergeyb | 2011-05-10 11:53:23 +0100 (Tue, 10 May 2011) | 1 line
  
  [CXF-3507] Support for Application constructor injection
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookApplication.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 10:55:43 2011
@@ -1 +1 @@
-/cxf/trunk:1099767,1100898
+/cxf/trunk:1099767,1100898,1101399

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=1101400&r1=1101399&r2=1101400&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
Tue May 10 10:55:43 2011
@@ -256,18 +256,7 @@ public class CXFNonSpringJaxrsServlet ex
     protected void createServerFromApplication(String cName, ServletConfig servletConfig)

         throws ServletException {
         Class<?> appClass = loadClass(cName, "Application");
-        Application app = null;
-        try {
-            app = (Application)appClass.newInstance();
-        } catch (InstantiationException ex) {
-            ex.printStackTrace();
-            throw new ServletException("Application class " + cName
-                                       + " can not be instantiated"); 
-        } catch (IllegalAccessException ex) {
-            ex.printStackTrace();
-            throw new ServletException("Application class " + cName
-                                       + " can not be instantiated due to IllegalAccessException");

-        }
+        Application app = (Application)createSingletonInstance(appClass, servletConfig);
         
         String ignoreParam = servletConfig.getInitParameter(IGNORE_APP_PATH_PARAM);
         JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, MessageUtils.isTrue(ignoreParam));

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookApplication.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookApplication.java?rev=1101400&r1=1101399&r2=1101400&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookApplication.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookApplication.java
Tue May 10 10:55:43 2011
@@ -21,12 +21,23 @@ package org.apache.cxf.systest.jaxrs;
 import java.util.HashSet;
 import java.util.Set;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.ApplicationPath;
 import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Context;
 
 @ApplicationPath("/thebooks")
 public class BookApplication extends Application {
 
+    public BookApplication(@Context ServletContext sc) {
+        if (sc == null) {
+            throw new IllegalArgumentException("ServletContext is null");
+        }
+        if (!"contextParamValue".equals(sc.getInitParameter("contextParam"))) {
+            throw new IllegalStateException("ServletContext is not initialized");
+        }
+    }
+    
     @Override
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml?rev=1101400&r1=1101399&r2=1101400&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml
(original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml
Tue May 10 10:55:43 2011
@@ -24,6 +24,10 @@
 -->
 <!-- START SNIPPET: webxml -->
 <web-app>
+    <context-param>
+      <param-name>contextParam</param-name>
+      <param-value>contextParamValue</param-value>
+    </context-param>
 	<servlet>
 		<servlet-name>CXFServlet</servlet-name>
 		<display-name>CXF Servlet</display-name>



Mime
View raw message