cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1087406 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/jaxb/ distribution/bundle/all/ rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ rt/core/src/main/java/org/apache/cxf/configuration/blueprint/ rt/core/src/main...
Date Thu, 31 Mar 2011 18:40:04 GMT
Author: dkulp
Date: Thu Mar 31 18:40:03 2011
New Revision: 1087406

URL: http://svn.apache.org/viewvc?rev=1087406&view=rev
Log:
Get jaxws:client working in blueprint

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java
    cxf/trunk/distribution/bundle/all/pom.xml
    cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/jaxb/JAXBContextCache.java Thu Mar
31 18:40:03 2011
@@ -177,7 +177,9 @@ public final class JAXBContextCache {
                         throw ex;
                     }
                 }
-
+                if (context == null) {
+                    throw ex;
+                }
             }
             cachedContextAndSchemas = new CachedContextAndSchemas(context, classes);
             synchronized (JAXBCONTEXT_CACHE) {

Modified: cxf/trunk/distribution/bundle/all/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/bundle/all/pom.xml?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/distribution/bundle/all/pom.xml (original)
+++ cxf/trunk/distribution/bundle/all/pom.xml Thu Mar 31 18:40:03 2011
@@ -304,10 +304,10 @@
                         <Specification-Vendor>The Apache Software Foundation</Specification-Vendor>
                         <Specification-Version>${cxf.osgi.version.clean}</Specification-Version>
                         <DynamicImport-Package>
-                            com.sun.xml.bind.api,
-                            com.sun.xml.bind.api.*,
-                            com.sun.xml.internal.bind.api,
-                            com.sun.xml.internal.bind.api.*,
+                            com.sun.xml.bind,
+                            com.sun.xml.bind.*,
+                            com.sun.xml.internal.bind,
+                            com.sun.xml.internal.bind.*,
                             com.ctc.wstx.*,
                             org.apache.commons.logging.*,
                             org.slf4j.*,

Modified: cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
(original)
+++ cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
Thu Mar 31 18:40:03 2011
@@ -57,8 +57,13 @@ public class ColocMessageObserver extend
 
     public void onMessage(Message m) {
         Bus origBus = BusFactory.getThreadDefaultBus(false);
-        BusFactory.setThreadDefaultBus(bus);
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
+            BusFactory.setThreadDefaultBus(bus);
             if (LOG.isLoggable(Level.FINER)) {
                 LOG.finer("Processing Message at collocated endpoint.  Request message: "
+ m);
             }
@@ -99,6 +104,7 @@ public class ColocMessageObserver extend
             setOutBoundMessage(ex, m.getExchange());
         } finally {
             BusFactory.setThreadDefaultBus(origBus);
+            Thread.currentThread().setContextClassLoader(origLoader);
         }
     }
     

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/configuration/blueprint/AbstractBPBeanDefinitionParser.java
Thu Mar 31 18:40:03 2011
@@ -51,9 +51,10 @@ public abstract class AbstractBPBeanDefi
     }
 
     public Metadata createValue(ParserContext context, QName qName) {
-        MutableValueMetadata v = context.createMetadata(MutableValueMetadata.class);
-        v.setType(QName.class.getName());
-        v.setStringValue(qName.toString());
+        MutableBeanMetadata v = context.createMetadata(MutableBeanMetadata.class);
+        v.setRuntimeClass(QName.class);
+        v.addArgument(createValue(context, qName.getNamespaceURI()), null, 0);
+        v.addArgument(createValue(context, qName.getLocalPart()), null, 1);
         return v;
     }
 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Thu Mar 31 18:40:03
2011
@@ -420,8 +420,13 @@ public class ClientImpl
                               Map<String, Object> context,
                               Exchange exchange) throws Exception {
         Bus origBus = BusFactory.getThreadDefaultBus(false);
-        BusFactory.setThreadDefaultBus(bus);
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            BusFactory.setThreadDefaultBus(bus);
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
             if (exchange == null) {
                 exchange = new ExchangeImpl();
             }
@@ -488,6 +493,7 @@ public class ClientImpl
                 return processResult(message, exchange, oi, resContext);
             }
         } finally {
+            Thread.currentThread().setContextClassLoader(origLoader);
             BusFactory.setThreadDefaultBus(origBus);
         }
     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
Thu Mar 31 18:40:03 2011
@@ -52,7 +52,12 @@ public abstract class AbstractFaultChain
         
         Bus origBus = BusFactory.getThreadDefaultBus(false);
         BusFactory.setThreadDefaultBus(bus);
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
             
             Exchange exchange = message.getExchange();
     
@@ -103,6 +108,7 @@ public abstract class AbstractFaultChain
             }
         } finally {
             BusFactory.setThreadDefaultBus(origBus);
+            Thread.currentThread().setContextClassLoader(origLoader);
         }
     }
 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
Thu Mar 31 18:40:03 2011
@@ -58,7 +58,12 @@ public class ChainInitiationObserver imp
     public void onMessage(Message m) {
         Bus origBus = BusFactory.getThreadDefaultBus(false);
         BusFactory.setThreadDefaultBus(bus);
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
             InterceptorChain phaseChain = null;
             
             if (m.getInterceptorChain() != null) {
@@ -114,6 +119,7 @@ public class ChainInitiationObserver imp
             
         } finally {
             BusFactory.setThreadDefaultBus(origBus);
+            Thread.currentThread().setContextClassLoader(origLoader);
         }
     }
     private void addToChain(InterceptorChain chain, Message m) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java
Thu Mar 31 18:40:03 2011
@@ -59,7 +59,12 @@ public class MultipleEndpointObserver im
     public void onMessage(Message message) {
         Bus origBus = BusFactory.getThreadDefaultBus(false);
         BusFactory.setThreadDefaultBus(bus);
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
             Exchange exchange = message.getExchange();
             if (exchange == null) {
                 exchange = new ExchangeImpl();
@@ -91,6 +96,7 @@ public class MultipleEndpointObserver im
             chain.doIntercept(message);
         } finally {
             BusFactory.setThreadDefaultBus(origBus);
+            Thread.currentThread().setContextClassLoader(origLoader);
         }
     }
 

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java
Thu Mar 31 18:40:03 2011
@@ -43,12 +43,17 @@ class ClientMessageObserver implements M
         message.getExchange().setInMessage(message);
         Bus origBus = BusFactory.getThreadDefaultBus(false);
         BusFactory.setThreadDefaultBus(cfg.getBus());
-
-        // execute chain
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader loader = cfg.getBus().getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
+            // execute chain
             chain.doIntercept(message);
         } finally {
             BusFactory.setThreadDefaultBus(origBus);
+            Thread.currentThread().setContextClassLoader(origLoader);
         }
     }
     

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.java
Thu Mar 31 18:40:03 2011
@@ -130,18 +130,29 @@ public class JaxWsProxyFactoryBean exten
      */
     @Override
     public Object create() {
-        Object obj = super.create();
-        Service service = getServiceFactory().getService();
-        if (needWrapperClassInterceptor(service.getServiceInfos().get(0))) {
-            List<Interceptor<? extends Message>> in = super.getInInterceptors();
-            List<Interceptor<? extends Message>> out = super.getOutInterceptors();
-            in.add(new WrapperClassInInterceptor());
-            in.add(new HolderInInterceptor());
-            out.add(new WrapperClassOutInterceptor());
-            out.add(new HolderOutInterceptor());
+        ClassLoader orig = Thread.currentThread().getContextClassLoader();
+        try {
+            if (getBus() != null) {
+                ClassLoader loader = getBus().getExtension(ClassLoader.class);
+                if (loader != null) {
+                    Thread.currentThread().setContextClassLoader(loader);
+                }
+            }
+            
+            Object obj = super.create();
+            Service service = getServiceFactory().getService();
+            if (needWrapperClassInterceptor(service.getServiceInfos().get(0))) {
+                List<Interceptor<? extends Message>> in = super.getInInterceptors();
+                List<Interceptor<? extends Message>> out = super.getOutInterceptors();
+                in.add(new WrapperClassInInterceptor());
+                in.add(new HolderInInterceptor());
+                out.add(new WrapperClassOutInterceptor());
+                out.add(new HolderOutInterceptor());
+            }
+            return obj;
+        } finally {
+            Thread.currentThread().setContextClassLoader(orig);
         }
-        return obj;
-              
     }
     
     private boolean needWrapperClassInterceptor(ServiceInfo serviceInfo) {

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
Thu Mar 31 18:40:03 2011
@@ -180,11 +180,23 @@ public class JaxWsServerFactoryBean exte
     }
     
     public Server create() {
-        Server server = super.create();
-        initializeResourcesAndHandlerChain();
-        checkPrivateEndpoint(server.getEndpoint());
-        
-        return server;
+        ClassLoader orig = Thread.currentThread().getContextClassLoader();
+        try {
+            if (bus != null) {
+                ClassLoader loader = bus.getExtension(ClassLoader.class);
+                if (loader != null) {
+                    Thread.currentThread().setContextClassLoader(loader);
+                }
+            }
+
+            Server server = super.create();
+            initializeResourcesAndHandlerChain();
+            checkPrivateEndpoint(server.getEndpoint());
+            
+            return server;
+        } finally {
+            Thread.currentThread().setContextClassLoader(orig);
+        }
     }
     
     private synchronized void initializeResourcesAndHandlerChain() {

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
Thu Mar 31 18:40:03 2011
@@ -117,54 +117,65 @@ public class ClientProxyFactoryBean exte
      * @return the proxy. You must cast the returned object to the appropriate class before
using it.
      */
     public Object create() {
-        configureObject();
-        
-        if (properties == null) {
-            properties = new HashMap<String, Object>();
+        ClassLoader orig = Thread.currentThread().getContextClassLoader();
+        try {
+            if (getBus() != null) {
+                ClassLoader loader = getBus().getExtension(ClassLoader.class);
+                if (loader != null) {
+                    Thread.currentThread().setContextClassLoader(loader);
+                }
+            }
+            configureObject();
+            
+            if (properties == null) {
+                properties = new HashMap<String, Object>();
+            }
+    
+            if (username != null) {
+                AuthorizationPolicy authPolicy = new AuthorizationPolicy();
+                authPolicy.setUserName(username);
+                authPolicy.setPassword(password);
+                properties.put(AuthorizationPolicy.class.getName(), authPolicy);
+            }
+    
+            initFeatures();
+            clientFactoryBean.setProperties(properties);
+    
+            if (bus != null) {
+                clientFactoryBean.setBus(bus);
+            }
+    
+            if (dataBinding != null) {
+                clientFactoryBean.setDataBinding(dataBinding);
+            }
+    
+            Client c = clientFactoryBean.create();
+            if (getInInterceptors() != null) {
+                c.getInInterceptors().addAll(getInInterceptors());
+            }
+            if (getOutInterceptors() != null) {
+                c.getOutInterceptors().addAll(getOutInterceptors());
+            }
+            if (getInFaultInterceptors() != null) {
+                c.getInFaultInterceptors().addAll(getInFaultInterceptors());
+            }
+            if (getOutFaultInterceptors() != null) {
+                c.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
+            }
+    
+            ClientProxy handler = clientClientProxy(c);
+    
+            Class classes[] = getImplementingClasses();
+            Object obj = Proxy.newProxyInstance(clientFactoryBean.getServiceClass().getClassLoader(),
+                                                classes,
+                                                handler);
+    
+            this.getServiceFactory().sendEvent(FactoryBeanListener.Event.PROXY_CREATED,
+                                               classes, handler, obj);
+            return obj;
+        } finally {
+            Thread.currentThread().setContextClassLoader(orig);
         }
-
-        if (username != null) {
-            AuthorizationPolicy authPolicy = new AuthorizationPolicy();
-            authPolicy.setUserName(username);
-            authPolicy.setPassword(password);
-            properties.put(AuthorizationPolicy.class.getName(), authPolicy);
-        }
-
-        initFeatures();
-        clientFactoryBean.setProperties(properties);
-
-        if (bus != null) {
-            clientFactoryBean.setBus(bus);
-        }
-
-        if (dataBinding != null) {
-            clientFactoryBean.setDataBinding(dataBinding);
-        }
-
-        Client c = clientFactoryBean.create();
-        if (getInInterceptors() != null) {
-            c.getInInterceptors().addAll(getInInterceptors());
-        }
-        if (getOutInterceptors() != null) {
-            c.getOutInterceptors().addAll(getOutInterceptors());
-        }
-        if (getInFaultInterceptors() != null) {
-            c.getInFaultInterceptors().addAll(getInFaultInterceptors());
-        }
-        if (getOutFaultInterceptors() != null) {
-            c.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
-        }
-
-        ClientProxy handler = clientClientProxy(c);
-
-        Class classes[] = getImplementingClasses();
-        Object obj = Proxy.newProxyInstance(clientFactoryBean.getServiceClass().getClassLoader(),
-                                            classes,
-                                            handler);
-
-        this.getServiceFactory().sendEvent(FactoryBeanListener.Event.PROXY_CREATED,
-                                           classes, handler, obj);
-        return obj;
     }
 
     protected Class[] getImplementingClasses() {

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
Thu Mar 31 18:40:03 2011
@@ -129,63 +129,75 @@ public class ServerFactoryBean extends A
     
 
     public Server create() {
+        ClassLoader orig = Thread.currentThread().getContextClassLoader();
         try {
-            if (getServiceFactory().getProperties() == null) {
-                getServiceFactory().setProperties(getProperties());
-            } else if (getProperties() != null) {
-                getServiceFactory().getProperties().putAll(getProperties());
-            }
-            if (serviceBean != null && getServiceClass() == null) {
-                setServiceClass(ClassHelper.getRealClass(serviceBean));
-            }
-            if (invoker != null) {
-                getServiceFactory().setInvoker(invoker);
-            } else if (serviceBean != null) {
-                invoker = createInvoker();
-                getServiceFactory().setInvoker(invoker);
-            }
-
-            Endpoint ep = createEndpoint();
-            server = new ServerImpl(getBus(),
-                                    ep,
-                                    getDestinationFactory(),
-                                    getBindingFactory());
-
-            if (ep.getService().getInvoker() == null) {
-                if (invoker == null) {
-                    ep.getService().setInvoker(createInvoker());
-                } else {
-                    ep.getService().setInvoker(invoker);
+            try {
+                if (bus != null) {
+                    ClassLoader loader = bus.getExtension(ClassLoader.class);
+                    if (loader != null) {
+                        Thread.currentThread().setContextClassLoader(loader);
+                    }
+                }
+    
+                if (getServiceFactory().getProperties() == null) {
+                    getServiceFactory().setProperties(getProperties());
+                } else if (getProperties() != null) {
+                    getServiceFactory().getProperties().putAll(getProperties());
+                }
+                if (serviceBean != null && getServiceClass() == null) {
+                    setServiceClass(ClassHelper.getRealClass(serviceBean));
+                }
+                if (invoker != null) {
+                    getServiceFactory().setInvoker(invoker);
+                } else if (serviceBean != null) {
+                    invoker = createInvoker();
+                    getServiceFactory().setInvoker(invoker);
+                }
+    
+                Endpoint ep = createEndpoint();
+                server = new ServerImpl(getBus(),
+                                        ep,
+                                        getDestinationFactory(),
+                                        getBindingFactory());
+    
+                if (ep.getService().getInvoker() == null) {
+                    if (invoker == null) {
+                        ep.getService().setInvoker(createInvoker());
+                    } else {
+                        ep.getService().setInvoker(invoker);
+                    }
                 }
+    
+            } catch (EndpointException e) {
+                throw new ServiceConstructionException(e);
+            } catch (BusException e) {
+                throw new ServiceConstructionException(e);
+            } catch (IOException e) {
+                throw new ServiceConstructionException(e);
             }
-
-        } catch (EndpointException e) {
-            throw new ServiceConstructionException(e);
-        } catch (BusException e) {
-            throw new ServiceConstructionException(e);
-        } catch (IOException e) {
-            throw new ServiceConstructionException(e);
-        }
-
-        if (serviceBean != null) {
-            initializeAnnotationInterceptors(server.getEndpoint(),
-                                             ClassHelper.getRealClass(getServiceBean()));
-        } else if (getServiceClass() != null) {
-            initializeAnnotationInterceptors(server.getEndpoint(), getServiceClass());
-        }
-
-        applyFeatures();
-
-        getServiceFactory().sendEvent(FactoryBeanListener.Event.SERVER_CREATED, server, serviceBean,
-                                      serviceBean == null 
-                                      ? getServiceClass() == null 
-                                          ? getServiceFactory().getServiceClass() : getServiceClass()
-                                          : ClassHelper.getRealClass(getServiceBean()));
-        
-        if (start) {
-            server.start();
-        }
-        return server;
+    
+            if (serviceBean != null) {
+                initializeAnnotationInterceptors(server.getEndpoint(),
+                                                 ClassHelper.getRealClass(getServiceBean()));
+            } else if (getServiceClass() != null) {
+                initializeAnnotationInterceptors(server.getEndpoint(), getServiceClass());
+            }
+    
+            applyFeatures();
+    
+            getServiceFactory().sendEvent(FactoryBeanListener.Event.SERVER_CREATED, server,
serviceBean,
+                                          serviceBean == null 
+                                          ? getServiceClass() == null 
+                                              ? getServiceFactory().getServiceClass() : getServiceClass()
+                                              : ClassHelper.getRealClass(getServiceBean()));
+            
+            if (start) {
+                server.start();
+            }
+            return server;
+        } finally {
+            Thread.currentThread().setContextClassLoader(orig);
+        }            
     }
     public void init() {
         if (getServer() == null) {

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Thu Mar 31 18:40:03 2011
@@ -276,11 +276,17 @@ public class JettyHTTPDestination extend
         }
 
         // REVISIT: service on executor if associated with endpoint
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
             BusFactory.setThreadDefaultBus(bus); 
             serviceRequest(context, req, resp);
         } finally {
-            BusFactory.setThreadDefaultBus(null);  
+            BusFactory.setThreadDefaultBus(null);
+            Thread.currentThread().setContextClassLoader(origLoader);
         }    
     }
 

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=1087406&r1=1087405&r2=1087406&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
Thu Mar 31 18:40:03 2011
@@ -103,11 +103,17 @@ public class CXFNonSpringServlet extends
 
     @Override
     protected void invoke(HttpServletRequest request, HttpServletResponse response) throws
ServletException {
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
             BusFactory.setThreadDefaultBus(bus);
             controller.invoke(request, response);
         } finally {
             BusFactory.setThreadDefaultBus(null);
+            Thread.currentThread().setContextClassLoader(origLoader);
         }
     }
 

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Thu Mar 31 18:40:03 2011
@@ -181,7 +181,12 @@ public class JMSDestination extends Abst
         onMessage(message, null);
     }
     public void onMessage(javax.jms.Message message, Session session) {
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
             getLogger().log(Level.FINE, "server received request: ", message);
              // Build CXF message from JMS message
             Message inMessage = new MessageImpl();            
@@ -248,6 +253,7 @@ public class JMSDestination extends Abst
             getLogger().log(Level.WARNING, "can't get the right encoding information. " +
ex);
         } finally {
             BusFactory.setThreadDefaultBus(null);
+            Thread.currentThread().setContextClassLoader(origLoader);
         }
     }
 

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java?rev=1087406&r1=1087405&r2=1087406&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
Thu Mar 31 18:40:03 2011
@@ -95,12 +95,18 @@ public class JMSContinuation implements 
     
     protected synchronized void doResume() {
         updateContinuations(true);
-        BusFactory.setThreadDefaultBus(bus);
+        ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
+            BusFactory.setThreadDefaultBus(bus);
+            ClassLoader loader = bus.getExtension(ClassLoader.class);
+            if (loader != null) {
+                Thread.currentThread().setContextClassLoader(loader);
+            }
             incomingObserver.onMessage(inMessage);
         } finally {
             isPending = false;
             BusFactory.setThreadDefaultBus(null);
+            Thread.currentThread().setContextClassLoader(origLoader);            
         }
     }
 



Mime
View raw message