cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1299900 - /cxf/trunk/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java
Date Mon, 12 Mar 2012 22:10:08 GMT
Author: sergeyb
Date: Mon Mar 12 22:10:07 2012
New Revision: 1299900

URL: http://svn.apache.org/viewvc?rev=1299900&view=rev
Log:
[CXF-4167] Making sure some of the cors properties can be customized if they are not set on
the annotation

Modified:
    cxf/trunk/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java

Modified: cxf/trunk/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java?rev=1299900&r1=1299899&r2=1299900&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java
(original)
+++ cxf/trunk/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java
Mon Mar 12 22:10:07 2012
@@ -385,14 +385,12 @@ public class CrossOriginResourceSharingF
     }
 
     private List<String> effectiveAllowOrigins(CrossOriginResourceSharing ann) {
-        if (ann != null) {
-            if (ann.allowOrigins() == null) {
-                return Collections.emptyList();
-            }
-            return Arrays.asList(ann.allowOrigins());
-        } else {
-            return allowOrigins;
-        }
+        List<String> actualOrigins = Collections.emptyList(); 
+        if (ann != null && ann.allowOrigins() != null) {
+            actualOrigins = Arrays.asList(ann.allowOrigins());
+        } 
+        
+        return actualOrigins.isEmpty() ? allowOrigins : actualOrigins;
     }
     
     private boolean effectiveAllowAnyHeaders(CrossOriginResourceSharing ann) {
@@ -404,25 +402,21 @@ public class CrossOriginResourceSharingF
     }
     
     private List<String> effectiveAllowHeaders(CrossOriginResourceSharing ann) {
-        if (ann != null) {
-            if (ann.allowHeaders() == null) {
-                return Collections.emptyList();
-            }
-            return Arrays.asList(ann.allowHeaders());
-        } else {
-            return allowHeaders;
-        }
+        List<String> actualHeaders = Collections.emptyList(); 
+        if (ann != null && ann.allowHeaders() != null) {
+            actualHeaders = Arrays.asList(ann.allowHeaders());
+        } 
+        
+        return actualHeaders.isEmpty() ? allowHeaders : actualHeaders;
     }
 
     private List<String> effectiveExposeHeaders(CrossOriginResourceSharing ann) {
-        if (ann != null) {
-            if (ann.exposeHeaders() == null) {
-                return Collections.emptyList();
-            }
-            return Arrays.asList(ann.exposeHeaders());
-        } else {
-            return exposeHeaders;
-        }
+        List<String> actualExposeHeaders = Collections.emptyList(); 
+        if (ann != null && ann.exposeHeaders() != null) {
+            actualExposeHeaders = Arrays.asList(ann.exposeHeaders());
+        } 
+        
+        return actualExposeHeaders.isEmpty() ? exposeHeaders : actualExposeHeaders;
     }
 
     private Integer effectiveMaxAge(CrossOriginResourceSharing ann) {



Mime
View raw message