cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1513226 - in /cxf/trunk/rt: frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/
Date Mon, 12 Aug 2013 19:14:19 GMT
Author: sergeyb
Date: Mon Aug 12 19:14:19 2013
New Revision: 1513226

URL: http://svn.apache.org/r1513226
Log:
Basic attempt at supporting Configuration injection

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
    cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=1513226&r1=1513225&r2=1513226&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
Mon Aug 12 19:14:19 2013
@@ -41,6 +41,7 @@ import java.util.logging.Logger;
 
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Configuration;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -92,6 +93,8 @@ public abstract class ProviderFactory {
         new NameKeyMap<ProviderInfo<ReaderInterceptor>>(true);
     protected Map<NameKey, ProviderInfo<WriterInterceptor>> writerInterceptors
= 
         new NameKeyMap<ProviderInfo<WriterInterceptor>>(true);
+    private Configuration dynamicConfiguration;
+    
     
     private List<ProviderInfo<MessageBodyReader<?>>> messageReaders = 
         new ArrayList<ProviderInfo<MessageBodyReader<?>>>();
@@ -156,6 +159,16 @@ public abstract class ProviderFactory {
         return null;
     }
     
+    public void setDynamicConfiguration(Configuration config) {
+        // Whatever is set inside Configuration is also set in this ProviderFactory
+        // We use it only to support Configuration injection at a basic level
+        this.dynamicConfiguration = config;
+    }
+    
+    public Configuration getDynamicConfiguration() {
+        return dynamicConfiguration;
+    }
+    
     public <T> ContextResolver<T> createContextResolver(Type contextType, 
                                                         Message m) {
         boolean isRequestor = MessageUtils.isRequestor(m);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java?rev=1513226&r1=1513225&r2=1513226&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ServerProviderFactory.java
Mon Aug 12 19:14:19 2013
@@ -342,8 +342,9 @@ public final class ServerProviderFactory
         Set<OperationResourceInfo> oris = cri.getMethodDispatcher().getOperationResourceInfos();
         for (OperationResourceInfo ori : oris) {
             for (DynamicFeature feature : dynamicFeatures) {
-                FeatureContext methodConfigurable = new MethodFeatureContextImpl(ori);
-                feature.configure(new ResourceInfoImpl(ori), methodConfigurable);
+                FeatureContext featureContext = new MethodFeatureContextImpl(ori);
+                feature.configure(new ResourceInfoImpl(ori), featureContext);
+                super.setDynamicConfiguration(featureContext.getConfiguration());
             }
         }
         Collection<ClassResourceInfo> subs = cri.getSubResources();

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=1513226&r1=1513225&r2=1513226&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Mon
Aug 12 19:14:19 2013
@@ -73,6 +73,7 @@ import javax.ws.rs.container.ContainerRe
 import javax.ws.rs.container.ResourceContext;
 import javax.ws.rs.container.ResourceInfo;
 import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Configuration;
 import javax.ws.rs.core.Cookie;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
@@ -1098,6 +1099,8 @@ public final class JAXRSUtils {
             o = new ProvidersImpl(contextMessage);
         } else if (ContextResolver.class.isAssignableFrom(clazz)) {
             o = createContextResolver(genericType, contextMessage);
+        } else if (Configuration.class.isAssignableFrom(clazz)) {
+            o = ProviderFactory.getInstance(contextMessage).getDynamicConfiguration();
         } else if (Application.class.isAssignableFrom(clazz)) {
             ProviderInfo<?> providerInfo = 
                 (ProviderInfo<?>)contextMessage.getExchange().getEndpoint().get(Application.class.getName());

Modified: cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java?rev=1513226&r1=1513225&r2=1513226&view=diff
==============================================================================
--- cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
(original)
+++ cxf/trunk/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
Mon Aug 12 19:14:19 2013
@@ -202,8 +202,8 @@ public class ClientImpl implements Clien
             }
             
             pf.setUserProviders(providers);
-            
-            WebClient.getConfig(targetClient).getRequestContext().putAll(configImpl.getConfiguration().getProperties());
+            pf.setDynamicConfiguration(getConfiguration());
+            WebClient.getConfig(targetClient).getRequestContext().putAll(getConfiguration().getProperties());
             
             // start building the invocation
             return new InvocationBuilderImpl(WebClient.fromClient(targetClient));



Mime
View raw message