cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Minor updates to JAXRS Factory beans to make it easier ovveride some of the checks
Date Mon, 19 Jan 2015 11:15:39 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 2f747962c -> c3d66a435


Minor updates to JAXRS Factory beans to make it easier ovveride some of the checks


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

Branch: refs/heads/3.0.x-fixes
Commit: c3d66a435f8e8d2b66c1b4e6a0382602eb310038
Parents: 2f74796
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Mon Jan 19 11:08:45 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Mon Jan 19 11:14:18 2015 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java    |  9 +++++++--
 .../java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java | 10 ++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c3d66a43/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
index dbddd9b..b9dfbbf 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
@@ -304,8 +304,7 @@ public class AbstractJAXRSFactoryBean extends AbstractEndpointFactory
{
         if (server) {
             for (Iterator<ClassResourceInfo> it = list.iterator(); it.hasNext();) {
                 ClassResourceInfo cri = it.next();
-                if (cri.isCreatedFromModel() && cri.getServiceClass() == cri.getResourceClass()

-                    && !InjectionUtils.isConcreteClass(cri.getServiceClass())) {
+                if (!isValidClassResourceInfo(cri)) {
                     it.remove();
                 }
             }
@@ -319,6 +318,12 @@ public class AbstractJAXRSFactoryBean extends AbstractEndpointFactory
{
         }
     }
     
+    protected boolean isValidClassResourceInfo(ClassResourceInfo cri) {
+        Class<?> serviceCls = cri.getServiceClass();
+        return !(cri.isCreatedFromModel() && serviceCls == cri.getResourceClass()

+            && !InjectionUtils.isConcreteClass(serviceCls));
+    }
+    
     protected void setupFactory(ProviderFactory factory, Endpoint ep) { 
         if (providerComparator != null) {
             factory.setProviderComparator(providerComparator);

http://git-wip-us.apache.org/repos/asf/cxf/blob/c3d66a43/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
index 5378854..1c35647 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
@@ -398,7 +398,7 @@ public class JAXRSServerFactoryBean extends AbstractJAXRSFactoryBean {
         this.start = start;
     }
 
-    private void injectContexts() {
+    protected void injectContexts() {
         Application application = appProvider == null ? null : appProvider.getProvider();
         for (ClassResourceInfo cri : serviceFactory.getClassResourceInfo()) {
             if (cri.isSingleton()) {
@@ -423,14 +423,16 @@ public class JAXRSServerFactoryBean extends AbstractJAXRSFactoryBean
{
             if (rp != null) {
                 cri.setResourceProvider(rp);
             } else {
-                //default lifecycle is per-request
-                rp = new PerRequestResourceProvider(cri.getResourceClass());
-                cri.setResourceProvider(rp);  
+                setDefaultResourceProvider(cri);  
             }
         }
         injectContexts();
     }
 
+    protected void setDefaultResourceProvider(ClassResourceInfo cri) {
+        cri.setResourceProvider(new PerRequestResourceProvider(cri.getResourceClass()));
+    }
+    
     /**
      * Set the reference to the document (WADL, etc) describing the endpoint
      * @param documentLocation document location


Mime
View raw message