cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6429, CXF-6307] Removing the parent ProviderFactory
Date Tue, 09 Jun 2015 13:31:31 GMT
Repository: cxf
Updated Branches:
  refs/heads/master d99c3428c -> 4e79ef514


[CXF-6429,CXF-6307] Removing the parent ProviderFactory


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4e79ef51
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4e79ef51
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4e79ef51

Branch: refs/heads/master
Commit: 4e79ef514e14ab325d13362076b8c63d5493ced8
Parents: d99c342
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Jun 9 14:31:09 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Jun 9 14:31:09 2015 +0100

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/model/ApplicationInfo.java |   2 +-
 .../cxf/jaxrs/model/FilterProviderInfo.java     |   2 +-
 .../apache/cxf/jaxrs/model/ProviderInfo.java    |  22 +-
 .../cxf/jaxrs/provider/ProviderFactory.java     | 263 +++++++------------
 .../jaxrs/provider/ServerProviderFactory.java   |  73 ++---
 .../jaxrs/servlet/CXFNonSpringJaxrsServlet.java |   4 +-
 .../cxf/jaxrs/provider/ProviderFactoryTest.java |  49 +++-
 .../cxf/jaxrs/client/ClientProviderFactory.java |  29 +-
 .../cxf/systest/jaxrs/JAXRSAsyncClientTest.java |   3 +-
 ...ServerResourceJacksonSpringProviderTest.java |   7 +
 .../jaxrs/JAXRSClientServerSpringBookTest.java  |   2 +-
 .../systest/jaxrs/RuntimeExceptionMapper.java   |   5 +-
 .../src/test/resources/jaxrs/WEB-INF/beans.xml  |  19 +-
 .../src/test/resources/jaxrs/WEB-INF/web.xml    |  18 ++
 .../jaxrs_jackson_provider/WEB-INF/beans.xml    |  12 +-
 15 files changed, 238 insertions(+), 272 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ApplicationInfo.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ApplicationInfo.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ApplicationInfo.java
index d60b319..f85fe5e 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ApplicationInfo.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ApplicationInfo.java
@@ -35,7 +35,7 @@ public class ApplicationInfo extends ProviderInfo<Application> {
     public ApplicationInfo(Application provider, 
                         Map<Class<?>, ThreadLocalProxy<?>> constructorProxies, 
                         Bus bus) {
-        super(provider, constructorProxies, bus);
+        super(provider, constructorProxies, bus, true);
     }
     
     public Map<String, Object> getProperties() {

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java
index fb68b96..ce09284 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/FilterProviderInfo.java
@@ -43,7 +43,7 @@ public class FilterProviderInfo<T> extends ProviderInfo<T> {
                               String nameBinding,
                               boolean dynamic,
                               Map<Class<?>, Integer> supportedContracts) {
-        super(provider, bus);
+        super(provider, bus, true);
         this.nameBinding = Collections.singleton(nameBinding);
         this.supportedContracts = supportedContracts;
         this.dynamic = dynamic;

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java
index afabd3c..89d2bcd 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java
@@ -27,27 +27,31 @@ import org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy;
 public class ProviderInfo<T> extends AbstractResourceInfo {
 
     private T provider;
+    private boolean custom;
     
-    public ProviderInfo(T provider, Bus bus) {
-        this(provider, bus, true);
+    public ProviderInfo(T provider, Bus bus, boolean custom) {
+        this(provider, bus, true, custom);
     }
     
-    public ProviderInfo(T provider, Bus bus, boolean checkContexts) {
-        this(provider, null, bus, checkContexts);
+    public ProviderInfo(T provider, Bus bus, boolean checkContexts, boolean custom) {
+        this(provider, null, bus, checkContexts, custom);
     }
     
     public ProviderInfo(T provider, 
                         Map<Class<?>, ThreadLocalProxy<?>> constructorProxies, 
-                        Bus bus) {
-        this(provider, constructorProxies, bus, true);
+                        Bus bus,
+                        boolean custom) {
+        this(provider, constructorProxies, bus, true, custom);
     }
     
     public ProviderInfo(T provider, 
                         Map<Class<?>, ThreadLocalProxy<?>> constructorProxies, 
                         Bus bus,
-                        boolean checkContexts) {
+                        boolean checkContexts,
+                        boolean custom) {
         super(provider.getClass(), provider.getClass(), true, checkContexts, constructorProxies, bus, provider);
         this.provider = provider;
+        this.custom = custom;
     }
     
     @Override
@@ -70,4 +74,8 @@ public class ProviderInfo<T> extends AbstractResourceInfo {
         return provider.hashCode();
     }
 
+    public boolean isCustom() {
+        return custom;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
index 6029d2c..c042093 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
@@ -57,6 +57,7 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ClassHelper;
+import org.apache.cxf.common.util.PropertyUtils;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxrs.ext.ContextProvider;
@@ -113,11 +114,9 @@ public abstract class ProviderFactory {
     
     private Bus bus;
     
-    private ProviderFactory baseFactory;
     private Comparator<?> providerComparator;
     
-    protected ProviderFactory(ProviderFactory baseFactory, Bus bus) {
-        this.baseFactory = baseFactory;
+    protected ProviderFactory(Bus bus) {
         this.bus = bus;
     }
     
@@ -125,24 +124,21 @@ public abstract class ProviderFactory {
         return bus;
     }
     
-    protected ProviderFactory getBaseFactory() {
-        return baseFactory;
-    }
-    
-    protected boolean isBaseFactory() {
-        return baseFactory == null;
-    }
-    
-    protected static void initBaseFactory(ProviderFactory factory) {
-        factory.setProviders(new BinaryDataProvider<Object>(),
-                                    new SourceProvider<Object>(),
-                                    new DataSourceProvider<Object>(),
-                                    new FormEncodingProvider<Object>(),
-                                    new StringTextProvider(),
-                                    new PrimitiveTextProvider<Object>(),
-                                    createProvider(JAXB_PROVIDER_NAME),
-                                    createProvider(JSON_PROVIDER_NAME),
-                                    new MultipartProvider());
+    protected static void initFactory(ProviderFactory factory) {
+        factory.setProviders(false,
+                     new BinaryDataProvider<Object>(),
+                     new SourceProvider<Object>(),
+                     new DataSourceProvider<Object>(),
+                     new FormEncodingProvider<Object>(),
+                     new StringTextProvider(),
+                     new PrimitiveTextProvider<Object>(),
+                     createProvider(JAXB_PROVIDER_NAME),
+                     new MultipartProvider());
+        Object prop = factory.getBus().getProperty("skip.default.json.provider.registration");
+        if (!PropertyUtils.isTrue(prop)) {
+            factory.setProviders(false, createProvider(JSON_PROVIDER_NAME));
+        }
+            
     }
     
     protected static Object createProvider(String className) {
@@ -266,12 +262,11 @@ public abstract class ProviderFactory {
         return null;
     }
     
-    protected <T> void handleMapper(List<T> candidates, 
-                                     ProviderInfo<T> em, 
-                                     Class<?> expectedType, 
-                                     Message m, 
-                                     Class<?> providerClass,
-                                     boolean injectContext) {
+    protected <T> boolean handleMapper(ProviderInfo<T> em, 
+                                       Class<?> expectedType, 
+                                       Message m, 
+                                       Class<?> providerClass,
+                                       boolean injectContext) {
         
         Class<?> mapperClass = ClassHelper.getRealClass(bus, em.getProvider());
         Type[] types = null;
@@ -292,19 +287,18 @@ public abstract class ProviderFactory {
                         boolean isResolved = false;
                         for (int j = 0; j < bounds.length; j++) {
                             Class<?> cls = InjectionUtils.getRawType(bounds[j]);
-                            if (cls != null && cls.isAssignableFrom(expectedType)) {
+                            if (cls != null && (cls == Object.class || cls.isAssignableFrom(expectedType))) {
                                 isResolved = true;
                                 break;
                             }
                         }
                         if (!isResolved) {
-                            return;
+                            return false;
                         }
                         if (injectContext) {
                             injectContextValues(em, m);
                         }
-                        candidates.add(em.getProvider());
-                        return;
+                        return true;
                     }
                     Class<?> actualClass = InjectionUtils.getRawType(arg);
                     if (actualClass == null) {
@@ -317,17 +311,17 @@ public abstract class ProviderFactory {
                         if (injectContext) {
                             injectContextValues(em, m);
                         }
-                        candidates.add(em.getProvider());
-                        return;
+                        return true;
                     }
                 }
             } else if (t instanceof Class && providerClass.isAssignableFrom((Class<?>)t)) {
                 if (injectContext) {
                     injectContextValues(em, m);
                 }
-                candidates.add(em.getProvider());
+                return true;
             }
         }
+        return false;
     }
         
     
@@ -408,52 +402,34 @@ public abstract class ProviderFactory {
     
     
     
-    public <T> MessageBodyReader<T> createMessageBodyReader(Class<T> bodyType,
-                                                            Type parameterType,
-                                                            Annotation[] parameterAnnotations,
+    @SuppressWarnings("unchecked")
+    public <T> MessageBodyReader<T> createMessageBodyReader(Class<T> type,
+                                                            Type genericType,
+                                                            Annotation[] annotations,
                                                             MediaType mediaType,
                                                             Message m) {
-        // Try user provided providers
-        MessageBodyReader<T> mr = chooseMessageReader(messageReaders,
-                                                      bodyType,
-                                                      parameterType,
-                                                      parameterAnnotations,
-                                                      mediaType,
-                                                      m);
-        
-        if (mr != null || isBaseFactory()) {
-            return mr;
-        }
-        return baseFactory.createMessageBodyReader(bodyType,
-                                                      parameterType,
-                                                      parameterAnnotations,
-                                                      mediaType,
-                                                      m);
+        for (ProviderInfo<MessageBodyReader<?>> ep : messageReaders) {
+            if (matchesReaderCriterias(ep, type, genericType, annotations, mediaType, m)
+                && handleMapper(ep, type, m, MessageBodyReader.class, false)) {
+                return (MessageBodyReader<T>)ep.getProvider();
+            }
+        }     
+        return null;
     }
     
-    public <T> MessageBodyWriter<T> createMessageBodyWriter(Class<T> bodyType,
-                                                            Type parameterType,
-                                                            Annotation[] parameterAnnotations,
+    @SuppressWarnings("unchecked")
+    public <T> MessageBodyWriter<T> createMessageBodyWriter(Class<T> type,
+                                                            Type genericType,
+                                                            Annotation[] annotations,
                                                             MediaType mediaType,
                                                             Message m) {
-        // Try user provided providers
-        MessageBodyWriter<T> mw = chooseMessageWriter(messageWriters, 
-                                                      bodyType,
-                                                      parameterType,
-                                                      parameterAnnotations,
-                                                      mediaType,
-                                                      m);
-        
-        
-        if (mw != null || isBaseFactory()) {
-            return mw;
+        for (ProviderInfo<MessageBodyWriter<?>> ep : messageWriters) {
+            if (matchesWriterCriterias(ep, type, genericType, annotations, mediaType, m)
+                && handleMapper(ep, type, m, MessageBodyWriter.class, false)) {
+                return (MessageBodyWriter<T>)ep.getProvider();
+            }
         }
-        
-        return baseFactory.createMessageBodyWriter(bodyType,
-                                                  parameterType,
-                                                  parameterAnnotations,
-                                                  mediaType,
-                                                  m);
+        return null;
     }
     
     protected void setBusProviders() {
@@ -465,7 +441,7 @@ public abstract class ProviderFactory {
                             MessageBodyWriter.class,
                             ExceptionMapper.class);
             if (!extensions.isEmpty()) {
-                setProviders(extensions.toArray());
+                setProviders(true, extensions.toArray());
                 bus.setProperty(alreadySetProp, "");
             }
         }
@@ -487,7 +463,7 @@ public abstract class ProviderFactory {
         }
     }
     
-    protected abstract void setProviders(Object... providers);
+    protected abstract void setProviders(boolean custom, Object... providers);
     
     @SuppressWarnings("unchecked")
     protected void setCommonProviders(List<ProviderInfo<? extends Object>> theProviders) {
@@ -614,42 +590,7 @@ public abstract class ProviderFactory {
     
         
     
-    /**
-     * Choose the first body reader provider that matches the requestedMimeType 
-     * for a sorted list of Entity providers
-     * Returns null if none is found.
-     * @param <T>
-     * @param messageBodyReaders
-     * @param type
-     * @param requestedMimeType
-     * @return
-     */
-    @SuppressWarnings("unchecked")
-    private <T> MessageBodyReader<T> chooseMessageReader(List<ProviderInfo<MessageBodyReader<?>>> readers,
-                                                         Class<T> type,
-                                                         Type genericType,
-                                                         Annotation[] annotations,
-                                                         MediaType mediaType,
-                                                         Message m) {
-        List<MessageBodyReader<?>> candidates = new LinkedList<MessageBodyReader<?>>();
-        for (ProviderInfo<MessageBodyReader<?>> ep : readers) {
-            if (matchesReaderCriterias(ep, type, genericType, annotations, mediaType, m)) {
-                if (isBaseFactory()) {
-                    return (MessageBodyReader<T>) ep.getProvider();
-                }
-                handleMapper(candidates, ep, type, m, MessageBodyReader.class, false);
-                if (!candidates.isEmpty()) {
-                    break;
-                }
-            }
-        }     
-        
-        if (candidates.isEmpty()) {
-            return null;
-        }
-        return (MessageBodyReader<T>) candidates.get(0);
-        
-    }
+    
     
     private <T> boolean matchesReaderCriterias(ProviderInfo<MessageBodyReader<?>> pi,
                                                Class<T> type,
@@ -672,41 +613,6 @@ public abstract class ProviderFactory {
         return ep.isReadable(type, genericType, annotations, mediaType);
     }
         
-    /**
-     * Choose the first body writer provider that matches the requestedMimeType 
-     * for a sorted list of Entity providers
-     * Returns null if none is found.
-     * @param <T>
-     * @param messageBodyWriters
-     * @param type
-     * @param requestedMimeType
-     * @return
-     */
-    @SuppressWarnings("unchecked")
-    private <T> MessageBodyWriter<T> chooseMessageWriter(List<ProviderInfo<MessageBodyWriter<?>>> writers,
-                                                         Class<T> type,
-                                                         Type genericType,
-                                                         Annotation[] annotations,
-                                                         MediaType mediaType,
-                                                         Message m) {
-        List<MessageBodyWriter<?>> candidates = new LinkedList<MessageBodyWriter<?>>();
-        for (ProviderInfo<MessageBodyWriter<?>> ep : writers) {
-            if (matchesWriterCriterias(ep, type, genericType, annotations, mediaType, m)) {
-                if (isBaseFactory()) {
-                    return (MessageBodyWriter<T>) ep.getProvider();
-                }
-                handleMapper(candidates, ep, type, m, MessageBodyWriter.class, false);
-                if (!candidates.isEmpty()) {
-                    break;
-                }
-            }
-        }     
-        if (candidates.isEmpty()) {
-            return null;
-        }
-        return (MessageBodyWriter<T>) candidates.get(0);
-    }
-    
     private <T> boolean matchesWriterCriterias(ProviderInfo<MessageBodyWriter<?>> pi,
                                                Class<T> type,
                                                Type genericType,
@@ -750,7 +656,7 @@ public abstract class ProviderFactory {
      * @param entityProviders the entityProviders to set
      */
     public void setUserProviders(List<?> userProviders) {
-        setProviders(userProviders.toArray());
+        setProviders(true, userProviders.toArray());
     }
 
     private static class MessageBodyReaderComparator 
@@ -770,7 +676,11 @@ public abstract class ProviderFactory {
             if (result != 0) {
                 return result;
             }
-            return compareClasses(e1, e2);
+            result = compareClasses(e1, e2);
+            if (result != 0) {
+                return result;
+            }
+            return compareCustomStatus(p1, p2);
         }
     }
     
@@ -791,10 +701,20 @@ public abstract class ProviderFactory {
             List<MediaType> types2 =
                 JAXRSUtils.sortMediaTypes(JAXRSUtils.getProviderProduceTypes(e2), JAXRSUtils.MEDIA_TYPE_QS_PARAM);
     
-            return JAXRSUtils.compareSortedMediaTypes(types1, types2, JAXRSUtils.MEDIA_TYPE_QS_PARAM);
+            result = JAXRSUtils.compareSortedMediaTypes(types1, types2, JAXRSUtils.MEDIA_TYPE_QS_PARAM);
+            if (result != 0) {
+                return result;
+            }
+            return compareCustomStatus(p1, p2);
         }
     }
     
+    private static int compareCustomStatus(ProviderInfo<?> p1, ProviderInfo<?> p2) {
+        Boolean custom1 = p1.isCustom();
+        Boolean custom2 = p2.isCustom();
+        return custom1.compareTo(custom2) * -1;
+    }
+    
     private static class ContextResolverComparator 
         implements Comparator<ProviderInfo<ContextResolver<?>>> {
         
@@ -816,9 +736,6 @@ public abstract class ProviderFactory {
     
     public void clearThreadLocalProxies() {
         clearProxies(injectedProviders);
-        if (baseFactory != null) {
-            baseFactory.clearThreadLocalProxies();
-        }
     }
     
     void clearProxies(Collection<?> ...lists) {
@@ -861,17 +778,8 @@ public abstract class ProviderFactory {
     }
     
     public void setSchemaLocations(List<String> schemas) {
-        boolean schemasMethodAvailable = false;
         for (ProviderInfo<MessageBodyReader<?>> r : messageReaders) {
-            schemasMethodAvailable = 
-                injectProviderProperty(r.getProvider(), "setSchemaLocations", List.class, schemas);
-        }
-        if (!schemasMethodAvailable) {
-            setProviders(createProvider(JAXB_PROVIDER_NAME),
-                         createProvider(JSON_PROVIDER_NAME));
-            for (ProviderInfo<MessageBodyReader<?>> r : messageReaders) {
-                injectProviderProperty(r.getProvider(), "setSchemaLocations", List.class, schemas);
-            }
+            injectProviderProperty(r.getProvider(), "setSchemaLocations", List.class, schemas);
         }
     }
 
@@ -918,9 +826,6 @@ public abstract class ProviderFactory {
                 ((AbstractConfigurableProvider)provider).init(cris);
             }
         }
-        if (!isBaseFactory()) {
-            baseFactory.initProviders(cris);
-        }
     }
     
     Set<Object> getReadersWriters() {
@@ -943,6 +848,19 @@ public abstract class ProviderFactory {
             return compareClasses(expectedCls, em1, em2);
         }
     }
+    public static class ProviderInfoClassComparator implements Comparator<ProviderInfo<?>> {
+        private ClassComparator comp;
+        public ProviderInfoClassComparator(Class<?> expectedCls) {
+            this.comp = new ClassComparator(expectedCls);
+        }
+        public int compare(ProviderInfo<?> p1, ProviderInfo<?> p2) {
+            int result = comp.compare(p1.getProvider(), p2.getProvider());
+            if (result == 0) {
+                result = compareCustomStatus(p1, p2);
+            }
+            return result;
+        }
+    }
     
     public static ProviderFactory getInstance(Message m) {
         Endpoint e = m.getExchange().getEndpoint();
@@ -1057,7 +975,8 @@ public abstract class ProviderFactory {
     public static ProviderInfo<? extends Object> createProviderFromConstructor(Constructor<?> c, 
                                                                  Map<Class<?>, Object> values,
                                                                  Bus theBus,
-                                                                 boolean checkContexts) {
+                                                                 boolean checkContexts,
+                                                                 boolean custom) {
         
         
         Map<Class<?>, Map<Class<?>, ThreadLocalProxy<?>>> proxiesMap = 
@@ -1095,7 +1014,7 @@ public abstract class ProviderFactory {
         if (isApplication) {
             return new ApplicationInfo((Application)instance, proxies, theBus);
         } else {
-            return new ProviderInfo<Object>(instance, proxies, theBus, checkContexts);
+            return new ProviderInfo<Object>(instance, proxies, theBus, checkContexts, custom);
         }
     }
     
@@ -1217,8 +1136,9 @@ public abstract class ProviderFactory {
         return result;
     }
     
-    protected List<ProviderInfo<? extends Object>> prepareProviders(Object[] providers,
-        ProviderInfo<Application> application) {
+    protected List<ProviderInfo<? extends Object>> prepareProviders(boolean custom,
+                                                                    Object[] providers,
+                                                                    ProviderInfo<Application> application) {
         List<ProviderInfo<? extends Object>> theProviders = 
             new ArrayList<ProviderInfo<? extends Object>>(providers.length);
         for (Object o : providers) {
@@ -1232,11 +1152,12 @@ public abstract class ProviderFactory {
             if (provider instanceof Constructor) {
                 Map<Class<?>, Object> values = CastUtils.cast(application == null ? null 
                     : Collections.singletonMap(Application.class, application.getProvider()));
-                theProviders.add(createProviderFromConstructor((Constructor<?>)provider, values, getBus(), true));
+                theProviders.add(
+                    createProviderFromConstructor((Constructor<?>)provider, values, getBus(), true, custom));
             } else if (provider instanceof ProviderInfo) {
                 theProviders.add((ProviderInfo<?>)provider);
             } else {    
-                theProviders.add(new ProviderInfo<Object>(provider, getBus()));
+                theProviders.add(new ProviderInfo<Object>(provider, getBus(), custom));
             }
         }
         return theProviders;

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
index d3a6ca24..325e7e7 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
@@ -65,7 +65,6 @@ import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 
 public final class ServerProviderFactory extends ProviderFactory {
-    private static final String SHARED_SERVER_FACTORY = "jaxrs.shared.server.factory";
     private static final Set<Class<?>> SERVER_FILTER_INTERCEPTOR_CLASSES = 
         new HashSet<Class<?>>(Arrays.<Class<?>>asList(ContainerRequestFilter.class,
                                                       ContainerResponseFilter.class,
@@ -89,11 +88,9 @@ public final class ServerProviderFactory extends ProviderFactory {
     private Map<Class<?>, BeanParamInfo> beanParams = new HashMap<Class<?>, BeanParamInfo>();
     private ProviderInfo<ContainerRequestFilter> wadlGenerator;
         
-    private ServerProviderFactory(ProviderFactory baseFactory, Bus bus) {
-        super(baseFactory, bus);
-        if (baseFactory == null) {
-            wadlGenerator = createWadlGenerator(bus);
-        }
+    private ServerProviderFactory(Bus bus) {
+        super(bus);
+        wadlGenerator = createWadlGenerator(bus);
     }
     
     private static ProviderInfo<ContainerRequestFilter> createWadlGenerator(Bus bus) {
@@ -101,7 +98,7 @@ public final class ServerProviderFactory extends ProviderFactory {
         if (provider == null) {
             return null;
         } else {
-            return new ProviderInfo<ContainerRequestFilter>((ContainerRequestFilter)provider, bus);
+            return new ProviderInfo<ContainerRequestFilter>((ContainerRequestFilter)provider, bus, true);
         }
     }
     
@@ -113,8 +110,9 @@ public final class ServerProviderFactory extends ProviderFactory {
         if (bus == null) {
             bus = BusFactory.getThreadDefaultBus();
         }
-        ServerProviderFactory baseFactory = initBaseFactory(bus);
-        ServerProviderFactory factory = new ServerProviderFactory(baseFactory, bus);
+        ServerProviderFactory factory = new ServerProviderFactory(bus);
+        ProviderFactory.initFactory(factory);
+        factory.setProviders(false, new WebApplicationExceptionMapper());
         factory.setBusProviders();
         return factory;
     }
@@ -124,21 +122,6 @@ public final class ServerProviderFactory extends ProviderFactory {
         return (ServerProviderFactory)e.get(SERVER_FACTORY_NAME);
     }
     
-    private static synchronized ServerProviderFactory initBaseFactory(Bus bus) {
-        ServerProviderFactory factory = (ServerProviderFactory)bus.getProperty(SHARED_SERVER_FACTORY);
-        if (factory != null) {
-            return factory;
-        }
-        factory = new ServerProviderFactory(null, bus);
-        ProviderFactory.initBaseFactory(factory);
-        factory.setProviders(new WebApplicationExceptionMapper());
-        
-        bus.setProperty(SHARED_SERVER_FACTORY, factory);
-
-
-        return factory;
-    }
-    
     public List<ProviderInfo<ContainerRequestFilter>> getPreMatchContainerRequestFilters() {
         return getContainerRequestFilters(preMatchContainerRequestFilters, true);
     }
@@ -150,20 +133,19 @@ public final class ServerProviderFactory extends ProviderFactory {
     
     private List<ProviderInfo<ContainerRequestFilter>> getContainerRequestFilters(
         List<ProviderInfo<ContainerRequestFilter>> filters, boolean syncNeeded) {
-        ProviderInfo<ContainerRequestFilter> generator = wadlGenerator != null ? wadlGenerator 
-            : ((ServerProviderFactory)getBaseFactory()).wadlGenerator;
-        if (generator == null) { 
+        
+        if (wadlGenerator == null) { 
             return filters;
         }
         if (filters.size() == 0) {
-            return Collections.singletonList(generator);
+            return Collections.singletonList(wadlGenerator);
         } else if (!syncNeeded) {
-            filters.add(0, generator);
+            filters.add(0, wadlGenerator);
             return filters;
         } else {
             synchronized (filters) {
-                if (filters.get(0) != generator) {
-                    filters.add(0, generator);
+                if (filters.get(0) != wadlGenerator) {
+                    filters.add(0, wadlGenerator);
                 }
             }
             return filters;
@@ -181,43 +163,34 @@ public final class ServerProviderFactory extends ProviderFactory {
     public BeanParamInfo getBeanParamInfo(Class<?> beanClass) {
         return beanParams.get(beanClass);
     }
-   
+
+    @SuppressWarnings("unchecked")
     public <T extends Throwable> ExceptionMapper<T> createExceptionMapper(Class<?> exceptionType,
                                                                           Message m) {
-        ExceptionMapper<T> mapper = doCreateExceptionMapper(exceptionType, m);
-        if (mapper != null || isBaseFactory()) {
-            return mapper;
-        }
-        
-        return ((ServerProviderFactory)getBaseFactory()).createExceptionMapper(exceptionType, m);
-    }
-    
-    @SuppressWarnings("unchecked")
-    private <T extends Throwable> ExceptionMapper<T> doCreateExceptionMapper(
-        Class<?> exceptionType, Message m) {
-        
-        List<ExceptionMapper<?>> candidates = new LinkedList<ExceptionMapper<?>>();
+        List<ProviderInfo<ExceptionMapper<?>>> candidates = new LinkedList<ProviderInfo<ExceptionMapper<?>>>();
         for (ProviderInfo<ExceptionMapper<?>> em : exceptionMappers) {
-            handleMapper(candidates, em, exceptionType, m, ExceptionMapper.class, true);
+            if (handleMapper(em, exceptionType, m, ExceptionMapper.class, true)) {
+                candidates.add(em);
+            }
         }
         if (candidates.size() == 0) {
             return null;
         }
-        Collections.sort(candidates, new ClassComparator(exceptionType));
-        return (ExceptionMapper<T>) candidates.get(0);
+        Collections.sort(candidates, new ProviderInfoClassComparator(exceptionType));
+        return (ExceptionMapper<T>) candidates.get(0).getProvider();
     }
     
     
     @SuppressWarnings("unchecked")
     @Override
-    protected void setProviders(Object... providers) {
+    protected void setProviders(boolean custom, Object... providers) {
         List<ProviderInfo<ContainerRequestFilter>> postMatchRequestFilters = 
             new LinkedList<ProviderInfo<ContainerRequestFilter>>();
         List<ProviderInfo<ContainerResponseFilter>> postMatchResponseFilters = 
             new LinkedList<ProviderInfo<ContainerResponseFilter>>();
         
         List<ProviderInfo<? extends Object>> theProviders = 
-            prepareProviders((Object[])providers, application);
+            prepareProviders(custom, (Object[])providers, application);
         super.setCommonProviders(theProviders);
         for (ProviderInfo<? extends Object> provider : theProviders) {
             Class<?> providerCls = ClassHelper.getRealClass(getBus(), provider.getProvider());

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
index b9b556d..5d2a698 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
@@ -429,13 +429,13 @@ public class CXFNonSpringJaxrsServlet extends CXFNonSpringServlet {
                 if (isApplication) {
                     provider = new ApplicationInfo((Application)c.newInstance(), getBus());
                 } else {
-                    provider = new ProviderInfo<Object>(c.newInstance(), getBus(), false);    
+                    provider = new ProviderInfo<Object>(c.newInstance(), getBus(), false, true);    
                 }
             } else {
                 Map<Class<?>, Object> values = new HashMap<Class<?>, Object>();
                 values.put(ServletContext.class, sc.getServletContext());
                 values.put(ServletConfig.class, sc);
-                provider = ProviderFactory.createProviderFromConstructor(c, values, getBus(), isApplication);
+                provider = ProviderFactory.createProviderFromConstructor(c, values, getBus(), isApplication, true);
             }
             Object instance = provider.getProvider();
             injectProperties(instance, props);

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
index 640f537..2d1e74c 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
@@ -93,9 +93,9 @@ public class ProviderFactoryTest extends Assert {
         WildcardReader2 reader2 = new WildcardReader2();
         pf.registerUserProvider(reader2);
         List<ProviderInfo<MessageBodyReader<?>>> readers = pf.getMessageReaders();
-        assertEquals(2, readers.size());
-        assertSame(reader1, readers.get(0).getProvider());
-        assertSame(reader2, readers.get(1).getProvider());
+        assertEquals(10, readers.size());
+        assertSame(reader1, readers.get(6).getProvider());
+        assertSame(reader2, readers.get(7).getProvider());
     }
     
     @Test
@@ -150,9 +150,7 @@ public class ProviderFactoryTest extends Assert {
         MessageBodyReader<Book> customJaxbReader = pf.createMessageBodyReader(
             Book.class, null, null, MediaType.TEXT_XML_TYPE, new MessageImpl());
         assertTrue(jaxbReader instanceof JAXBElementProvider);
-        assertNotSame(jaxbReader, customJaxbReader);
-        
-        assertNull(((JAXBElementProvider<Book>)jaxbReader).getSchema());
+        assertSame(jaxbReader, customJaxbReader);
         assertNotNull(((JAXBElementProvider<Book>)customJaxbReader).getSchema());
     }
     
@@ -203,7 +201,9 @@ public class ProviderFactoryTest extends Assert {
         
         TestRuntimeExceptionMapper rm = new TestRuntimeExceptionMapper(); 
         pf.registerUserProvider(rm);
-        assertSame(rm, pf.createExceptionMapper(WebApplicationException.class, new MessageImpl()));
+        ExceptionMapper<WebApplicationException> em = 
+            pf.createExceptionMapper(WebApplicationException.class, new MessageImpl());
+        assertTrue(em instanceof WebApplicationExceptionMapper);
         assertSame(rm, pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
         
         WebApplicationExceptionMapper wm = new WebApplicationExceptionMapper(); 
@@ -232,6 +232,22 @@ public class ProviderFactoryTest extends Assert {
         assertTrue(mbr instanceof StringTextProvider);
     }
     @Test
+    public void testMessageBodyReaderBoolean() throws Exception {
+        ProviderFactory pf = ServerProviderFactory.getInstance();
+        pf.registerUserProvider(new CustomBooleanReader());
+        MessageBodyReader<Boolean> mbr = pf.createMessageBodyReader(Boolean.class, Boolean.class, new Annotation[]{}, 
+                                   MediaType.TEXT_PLAIN_TYPE, new MessageImpl());
+        assertTrue(mbr instanceof PrimitiveTextProvider);
+    }
+    @Test
+    public void testMessageBodyReaderBoolean2() throws Exception {
+        ProviderFactory pf = ServerProviderFactory.getInstance();
+        pf.registerUserProvider(new CustomBooleanReader2());
+        MessageBodyReader<Boolean> mbr = pf.createMessageBodyReader(Boolean.class, Boolean.class, new Annotation[]{}, 
+                                   MediaType.TEXT_PLAIN_TYPE, new MessageImpl());
+        assertTrue(mbr instanceof CustomBooleanReader2);
+    }
+    @Test
     public void testMessageBodyWriterString() throws Exception {
         ProviderFactory pf = ServerProviderFactory.getInstance();
         MessageBodyWriter<String> mbr = pf.createMessageBodyWriter(String.class, String.class, new Annotation[]{}, 
@@ -908,4 +924,23 @@ public class ProviderFactoryTest extends Assert {
             return null;
         }
     }
+    @Consumes("text/plain")
+    public static class CustomBooleanReader2 extends CustomBooleanReader {
+        
+    }
+    public static class CustomBooleanReader implements MessageBodyReader<Boolean> {
+        @Override
+        public boolean isReadable(Class<?> type, Type type1, Annotation[] antns, MediaType mt) {
+            return type == Boolean.class;
+        }
+        @Override
+        public Boolean readFrom(Class<Boolean> type,
+                                 Type type1,
+                                 Annotation[] antns,
+                                 MediaType mt, MultivaluedMap<String, String> mm,
+                                 InputStream in) throws IOException, WebApplicationException {
+            return Boolean.TRUE;        
+        }
+    }
+    
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProviderFactory.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProviderFactory.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProviderFactory.java
index cd2370d..b094a9a 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProviderFactory.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProviderFactory.java
@@ -36,8 +36,6 @@ import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.message.Message;
 
 public final class ClientProviderFactory extends ProviderFactory {
-    private static final String SHARED_CLIENT_FACTORY = "jaxrs.shared.client.factory";
-    
     private List<ProviderInfo<ClientRequestFilter>> clientRequestFilters = 
         new ArrayList<ProviderInfo<ClientRequestFilter>>(1);
     private List<ProviderInfo<ClientResponseFilter>> clientResponseFilters = 
@@ -45,16 +43,16 @@ public final class ClientProviderFactory extends ProviderFactory {
     private List<ProviderInfo<ResponseExceptionMapper<?>>> responseExceptionMappers = 
         new ArrayList<ProviderInfo<ResponseExceptionMapper<?>>>(1);
     
-    private ClientProviderFactory(ProviderFactory baseFactory, Bus bus) {
-        super(baseFactory, bus);
+    private ClientProviderFactory(Bus bus) {
+        super(bus);
     }
     
     public static ClientProviderFactory createInstance(Bus bus) {
         if (bus == null) {
             bus = BusFactory.getThreadDefaultBus();
         }
-        ClientProviderFactory baseFactory = initBaseFactory(bus);
-        ClientProviderFactory factory = new ClientProviderFactory(baseFactory, bus);
+        ClientProviderFactory factory = new ClientProviderFactory(bus);
+        ProviderFactory.initFactory(factory);
         factory.setBusProviders();
         return factory;
     }
@@ -68,20 +66,11 @@ public final class ClientProviderFactory extends ProviderFactory {
         return (ClientProviderFactory)e.get(CLIENT_FACTORY_NAME);
     }
        
-    private static synchronized ClientProviderFactory initBaseFactory(Bus bus) {
-        ClientProviderFactory factory = (ClientProviderFactory)bus.getProperty(SHARED_CLIENT_FACTORY);
-        if (factory != null) {
-            return factory;
-        }
-        factory = new ClientProviderFactory(null, bus);
-        ProviderFactory.initBaseFactory(factory);
-        bus.setProperty(SHARED_CLIENT_FACTORY, factory);
-        return factory;
-    }
+    
     @Override
-    protected void setProviders(Object... providers) {
+    protected void setProviders(boolean custom, Object... providers) {
         List<ProviderInfo<? extends Object>> theProviders = 
-            prepareProviders((Object[])providers, null);
+            prepareProviders(custom, (Object[])providers, null);
         super.setCommonProviders(theProviders);
         for (ProviderInfo<? extends Object> provider : theProviders) {
             Class<?> providerCls = ClassHelper.getRealClass(getBus(), provider.getProvider());
@@ -112,7 +101,9 @@ public final class ClientProviderFactory extends ProviderFactory {
         List<ResponseExceptionMapper<?>> candidates = new LinkedList<ResponseExceptionMapper<?>>();
         
         for (ProviderInfo<ResponseExceptionMapper<?>> em : responseExceptionMappers) {
-            handleMapper(candidates, em, paramType, m, ResponseExceptionMapper.class, true);
+            if (handleMapper(em, paramType, m, ResponseExceptionMapper.class, true)) {
+                candidates.add(em.getProvider());
+            }
         }
         if (candidates.size() == 0) {
             return null;

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
index f1decea..a8bf64e 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSAsyncClientTest.java
@@ -29,6 +29,7 @@ import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 
+import javax.ws.rs.Consumes;
 import javax.ws.rs.NotFoundException;
 import javax.ws.rs.ProcessingException;
 import javax.ws.rs.WebApplicationException;
@@ -278,7 +279,7 @@ public class JAXRSAsyncClientTest extends AbstractBusClientServerTestBase {
         }
         
     }
-    
+    @Consumes("application/xml")
     private static class FaultyBookReader implements MessageBodyReader<Book> {
 
         @Override

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
index 8dac5bf..95184cd 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceJacksonSpringProviderTest.java
@@ -33,6 +33,7 @@ import javax.ws.rs.core.MediaType;
 
 import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 
+import org.apache.cxf.BusFactory;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.WebClient;
@@ -41,6 +42,7 @@ import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
 import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -53,6 +55,11 @@ public class JAXRSClientServerResourceJacksonSpringProviderTest extends Abstract
         assertTrue("server did not launch correctly",
                    launchServer(BookServerResourceJacksonSpringProviders.class, true));
         createStaticBus();
+        BusFactory.getDefaultBus().setProperty("skip.default.json.provider.registration", true);
+    }
+    @AfterClass
+    public static void afterClass() throws Exception {
+        BusFactory.getDefaultBus().getProperties().remove("skip.default.json.provider.registration");
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
index 72afb43..5ad1242 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
@@ -482,7 +482,7 @@ public class JAXRSClientServerSpringBookTest extends AbstractBusClientServerTest
     
     @Test
     public void testGetBookJsonpJackson() throws Exception {
-        String url = "http://localhost:" + PORT + "/the/jsonp2/books/123";
+        String url = "http://localhost:" + PORT + "/bus/jsonp2/books/123";
         WebClient client = WebClient.create(url);
         WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(10000000);
         client.accept("application/json, application/x-javascript");

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/RuntimeExceptionMapper.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/RuntimeExceptionMapper.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/RuntimeExceptionMapper.java
index 412ebb6..19887dd 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/RuntimeExceptionMapper.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/RuntimeExceptionMapper.java
@@ -18,17 +18,18 @@
  */
 package org.apache.cxf.systest.jaxrs;
 
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.ExceptionMapper;
 
-public class RuntimeExceptionMapper implements ExceptionMapper<RuntimeException> {
+public class RuntimeExceptionMapper implements ExceptionMapper<WebApplicationException> {
 
     @Context 
     private UriInfo ui;
     
-    public Response toResponse(RuntimeException exception) {
+    public Response toResponse(WebApplicationException exception) {
         String path = ui.getPath();
         if (path.endsWith("nonexistent")) {
             return Response.status(405).type("text/plain").entity("Nonexistent method").build();

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
index ab7c78f..ce855da 100644
--- a/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
+++ b/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
@@ -18,13 +18,11 @@
   under the License.
 -->
 <!-- START SNIPPET: beans -->
-<!--beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xmlns:simple="http://cxf.apache.org/simple"
-  xsi:schemaLocation="
-  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-  http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd"-->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:cxf="http://cxf.apache.org/core" xsi:schemaLocation=" http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util  http://www.springframework.org/schema/util/spring-util.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xmlns:util="http://www.springframework.org/schema/util" 
+    xmlns:jaxrs="http://cxf.apache.org/jaxrs" 
+    xmlns:cxf="http://cxf.apache.org/core" 
+    xsi:schemaLocation=" http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util  http://www.springframework.org/schema/util/spring-util.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
     <import resource="classpath:META-INF/cxf/cxf.xml"/>
     <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
     <bean class="org.apache.cxf.systest.jaxrs.BookStoreSpring" id="serviceBean"/>
@@ -133,7 +131,12 @@
             <bean class="org.apache.cxf.jaxrs.provider.jsonp.JsonpPostStreamInterceptor"/>
         </jaxrs:outInterceptors>
     </jaxrs:server>
-    <jaxrs:server id="bookJsonp2" address="/jsonp2">
+    <cxf:bus name="cxf2" id="cxf2">
+       <cxf:properties>
+           <entry key="skip.default.json.provider.registration" value="true"/>
+       </cxf:properties>
+    </cxf:bus>
+    <jaxrs:server id="bookJsonp2" address="/jsonp2" bus="cxf2">
         <jaxrs:serviceBeans>
             <ref bean="serviceBean"/>
         </jaxrs:serviceBeans>

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/web.xml b/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/web.xml
index 0c72578..e872d41 100644
--- a/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/web.xml
+++ b/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/web.xml
@@ -37,9 +37,27 @@
                 </servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>
+    <servlet>
+        <servlet-name>CXFServlet2</servlet-name>
+        <display-name>CXF Servlet2</display-name>
+        <servlet-class>
+                        org.apache.cxf.transport.servlet.CXFServlet
+                </servlet-class>
+        <init-param>
+            <param-name>bus</param-name>
+            <param-value>
+                  cxf2
+            </param-value>
+        </init-param>        
+        <load-on-startup>1</load-on-startup>
+    </servlet>
     <servlet-mapping>
         <servlet-name>CXFServlet</servlet-name>
         <url-pattern>/the/*</url-pattern>
     </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>CXFServlet2</servlet-name>
+        <url-pattern>/bus/*</url-pattern>
+    </servlet-mapping>
 </web-app>
 <!-- END SNIPPET: webxml -->

http://git-wip-us.apache.org/repos/asf/cxf/blob/4e79ef51/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml b/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
index bafb0e6..6781268 100644
--- a/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
+++ b/systests/jaxrs/src/test/resources/jaxrs_jackson_provider/WEB-INF/beans.xml
@@ -49,8 +49,16 @@ http://cxf.apache.org/schemas/jaxrs.xsd">
             <ref bean="jackson"/>
         </jaxrs:providers>
     </jaxrs:server>
-    
-    <core:bus name="cxf1" id="cxf1"/>
+    <core:bus>
+       <core:properties>
+           <entry key="skip.default.json.provider.registration" value="true"/>
+       </core:properties>
+    </core:bus>
+    <core:bus name="cxf1" id="cxf1">
+       <core:properties>
+           <entry key="skip.default.json.provider.registration" value="true"/>
+       </core:properties>
+    </core:bus>
     
     <jaxrs:server id="genericBookStore"
                   bus="cxf1"


Mime
View raw message