cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1484982 - /cxf/branches/2.7.x-fixes/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java
Date Tue, 21 May 2013 21:50:00 GMT
Author: sergeyb
Date: Tue May 21 21:50:00 2013
New Revision: 1484982

URL: http://svn.apache.org/r1484982
Log:
Fixing CORS test on 2.7.x

Modified:
    cxf/branches/2.7.x-fixes/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java

Modified: cxf/branches/2.7.x-fixes/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java?rev=1484982&r1=1484981&r2=1484982&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/security/cors/src/main/java/org/apache/cxf/rs/security/cors/CrossOriginResourceSharingFilter.java
Tue May 21 21:50:00 2013
@@ -90,19 +90,19 @@ public class CrossOriginResourceSharingF
     private boolean defaultOptionsMethodsHandlePreflight;
     
     
-    private <T extends Annotation> T  getAnnotation(OperationResourceInfo ori,
+    private <T extends Annotation> T  getAnnotation(Method m,
                                                     Class<T> annClass) {
-        if (ori == null) {
+        if (m == null) {
             return null;
         }
         return ReflectionUtil.getAnnotationForMethodOrContainingClass(
-             ori.getAnnotatedMethod(),  annClass);
+             m,  annClass);
     }
 
     public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
         OperationResourceInfo opResInfo = m.getExchange().get(OperationResourceInfo.class);
-        CrossOriginResourceSharing annotation = 
-            getAnnotation(opResInfo, CrossOriginResourceSharing.class);
+        CrossOriginResourceSharing annotation = opResInfo == null ? null 
+            : getAnnotation(opResInfo.getAnnotatedMethod(), CrossOriginResourceSharing.class);
         
         if ("OPTIONS".equals(m.get(Message.HTTP_REQUEST_METHOD))) {
             return preflightRequest(m, annotation, opResInfo, resourceClass);
@@ -196,8 +196,8 @@ public class CrossOriginResourceSharingF
          * has one of our annotations on it (or its parent class) indicating 'localPreflight'
--
          * or the defaultOptionsMethodsHandlePreflight flag is true.
          */
-        LocalPreflight preflightAnnotation = 
-            getAnnotation(opResInfo, LocalPreflight.class);
+        LocalPreflight preflightAnnotation = opResInfo == null ? null 
+            : getAnnotation(opResInfo.getAnnotatedMethod(), LocalPreflight.class);
         if (preflightAnnotation != null || defaultOptionsMethodsHandlePreflight) { 
             m.put(LOCAL_PREFLIGHT, "true");
             m.put(LOCAL_PREFLIGHT_ORIGIN, origin);
@@ -205,7 +205,7 @@ public class CrossOriginResourceSharingF
             return null; // let the resource method take all responsibility.
         }
         
-        CrossOriginResourceSharing ann = method.getAnnotation(CrossOriginResourceSharing.class);
+        CrossOriginResourceSharing ann = getAnnotation(method, CrossOriginResourceSharing.class);
         ann = ann == null ? corsAnn : ann;
         
         /* We aren't required to have any annotation at all. If no annotation,



Mime
View raw message