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-6112] Updating ResourceContextProvider
Date Fri, 21 Nov 2014 10:32:52 GMT
Repository: cxf
Updated Branches:
  refs/heads/master c32136c0b -> 940c34399


[CXF-6112] Updating ResourceContextProvider


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

Branch: refs/heads/master
Commit: 940c343998818963ae9b738167e249f9499cb7a6
Parents: c32136c
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Nov 21 10:32:16 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Nov 21 10:32:16 2014 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/ext/ResourceContextProvider.java   | 4 +++-
 .../java/org/apache/cxf/jaxrs/impl/ResourceContextImpl.java | 9 ++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/940c3439/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResourceContextProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResourceContextProvider.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResourceContextProvider.java
index f9337ff..0f2cc7e 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResourceContextProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ResourceContextProvider.java
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.jaxrs.ext;
 
+import org.apache.cxf.jaxrs.lifecycle.ResourceProvider;
+
 public interface ResourceContextProvider {
-    <T> T getResource(Class<T> cls);
+    ResourceProvider getResourceProvider(Class<?> cls);
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/940c3439/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResourceContextImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResourceContextImpl.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResourceContextImpl.java
index 0a74deb..5e43f11 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResourceContextImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResourceContextImpl.java
@@ -22,6 +22,7 @@ import javax.ws.rs.container.ResourceContext;
 
 import org.apache.cxf.jaxrs.ext.ResourceContextProvider;
 import org.apache.cxf.jaxrs.lifecycle.PerRequestResourceProvider;
+import org.apache.cxf.jaxrs.lifecycle.ResourceProvider;
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.model.OperationResourceInfo;
 import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
@@ -40,13 +41,15 @@ public class ResourceContextImpl implements ResourceContext {
     
     @Override
     public <T> T getResource(Class<T> cls) {
-        T resource = null;
+        ResourceProvider rp = null;
+        
         Object propValue = m.getContextualProperty(CONTEXT_PROVIDER_PROP);
         if (propValue instanceof ResourceContextProvider) {
-            resource = ((ResourceContextProvider)propValue).getResource(cls);
+            rp = ((ResourceContextProvider)propValue).getResourceProvider(cls);
         } else { 
-            resource = cls.cast(new PerRequestResourceProvider(cls).getInstance(m));
+            rp = new PerRequestResourceProvider(cls);
         }
+        T resource = cls.cast(rp.getInstance(m));
         return doInitResource(cls, resource);
     }
     


Mime
View raw message