cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r935057 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/
Date Fri, 16 Apr 2010 19:36:56 GMT
Author: dkulp
Date: Fri Apr 16 19:36:56 2010
New Revision: 935057

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

........
  r935055 | dkulp | 2010-04-16 15:33:18 -0400 (Fri, 16 Apr 2010) | 4 lines
  
  [CXF-2730] For spring 3, make sure the servlet is registered as a
  listener that will survive a refresh
  Also make sure destroy is called on servers using simple:server and
  jaxws:server
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java
    cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java

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

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java?rev=935057&r1=935056&r2=935057&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/NamespaceHandler.java
Fri Apr 16 19:36:56 2010
@@ -50,7 +50,12 @@ public class NamespaceHandler extends Na
         public SpringServerFactoryBean(JaxWsServiceFactoryBean fact) {
             super(fact);
         }
-
+        public void destroy() {
+            if (getServer() != null) {
+                getServer().destroy();
+                setServer(null);
+            }
+        }
         public void setApplicationContext(ApplicationContext ctx) throws BeansException {
             if (getBus() == null) {
                 Bus bus = BusFactory.getThreadDefaultBus();

Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java?rev=935057&r1=935056&r2=935057&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ServerFactoryBeanDefinitionParser.java
Fri Apr 16 19:36:56 2010
@@ -87,6 +87,7 @@ public class ServerFactoryBeanDefinition
         super.doParse(element, ctx, bean);
 
         bean.setInitMethodName("create");
+        bean.setDestroyMethodName("destroy");
         
         // We don't really want to delay the registration of our Server
         bean.setLazyInit(false);
@@ -119,7 +120,13 @@ public class ServerFactoryBeanDefinition
         public SpringServerFactoryBean(ReflectionServiceFactoryBean fact) {
             super(fact);
         }
-        
+        public void destroy() {
+            if (getServer() != null) {
+                getServer().destroy();
+                setServer(null);
+            }
+        }
+
         public void setApplicationContext(ApplicationContext ctx) throws BeansException {
             if (getBus() == null) {
                 Bus bus = BusFactory.getThreadDefaultBus();

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?rev=935057&r1=935056&r2=935057&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
Fri Apr 16 19:36:56 2010
@@ -22,6 +22,7 @@ package org.apache.cxf.transport.servlet
 import java.io.IOException;
 import java.io.InputStream;
 
+import java.util.Collection;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -34,6 +35,7 @@ import org.apache.cxf.bus.spring.BusAppl
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.resource.URIResolver;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -42,6 +44,7 @@ import org.springframework.context.Appli
 import org.springframework.context.ApplicationListener;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.core.io.InputStreamResource;
 
@@ -103,7 +106,23 @@ public class CXFServlet extends Abstract
         if (ctx instanceof ConfigurableApplicationContext) {
             ((ConfigurableApplicationContext)ctx).addApplicationListener(this);
         }
+        if (ctx instanceof AbstractApplicationContext) {
+            Collection<ApplicationListener> lst = getListeners(ctx);
+            if (lst != null && !lst.contains(this)) {
+                lst.add(this);
+            }
+        }
+    }
+    private Collection<ApplicationListener> getListeners(ApplicationContext ctx) {
+        try {
+            Object o = ctx.getClass().getMethod("getApplicationListeners").invoke(ctx);
+            return CastUtils.cast((Collection<?>)o);
+        } catch (Exception e) {
+            //ignore
+        }
+        return null;
     }
+    
     private void updateContext(ServletConfig servletConfig, ApplicationContext ctx) {
         /* If ctx is null, normally no ContextLoaderListener 
          * was defined in web.xml.  Default bus with all extensions



Mime
View raw message