cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1548573 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceServer.java
Date Fri, 06 Dec 2013 15:56:10 GMT
Author: sergeyb
Date: Fri Dec  6 15:56:10 2013
New Revision: 1548573

URL: http://svn.apache.org/r1548573
Log:
[CXF-3725] Optionally restricting the bean names in SpringResourceServer

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceServer.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceServer.java?rev=1548573&r1=1548572&r2=1548573&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceServer.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceServer.java
Fri Dec  6 15:56:10 2013
@@ -20,6 +20,7 @@ package org.apache.cxf.jaxrs.spring;
 
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
 
 import javax.ws.rs.Path;
 import javax.ws.rs.ext.Provider;
@@ -43,6 +44,7 @@ public class SpringResourceServer {
     private ApplicationContext ctx;
 
     private String address = "/";
+    private Set<String> supportedBeanNames;
     
     @Bean
     public Server jaxrsServer() {
@@ -50,12 +52,14 @@ public class SpringResourceServer {
         List<Object> jaxrsProviders = new LinkedList<Object>();
         
         for (String beanName : ctx.getBeanDefinitionNames()) {
-            if (ctx.findAnnotationOnBean(beanName, Path.class) != null) {
-                SpringResourceFactory factory = new SpringResourceFactory(beanName);
-                factory.setApplicationContext(ctx);
-                resourceProviders.add(factory);
-            } else if (checkJaxrsProviders() && ctx.findAnnotationOnBean(beanName,
Provider.class) != null) {
-                jaxrsProviders.add(ctx.getBean(beanName));
+            if (isBeanSupported(beanName)) {
+                if (ctx.findAnnotationOnBean(beanName, Path.class) != null) {
+                    SpringResourceFactory factory = new SpringResourceFactory(beanName);
+                    factory.setApplicationContext(ctx);
+                    resourceProviders.add(factory);
+                } else if (checkJaxrsProviders() && ctx.findAnnotationOnBean(beanName,
Provider.class) != null) {
+                    jaxrsProviders.add(ctx.getBean(beanName));
+                }
             }
         }
 
@@ -78,4 +82,16 @@ public class SpringResourceServer {
     public void setAddress(String address) {
         this.address = address;
     }
+
+    public Set<String> getSupportedBeanNames() {
+        return supportedBeanNames;
+    }
+
+    public void setSupportedBeanNames(Set<String> supportedBeanNames) {
+        this.supportedBeanNames = supportedBeanNames;
+    }
+    
+    protected boolean isBeanSupported(String beanName) {
+        return supportedBeanNames == null || supportedBeanNames.contains(beanName);
+    }
 }



Mime
View raw message