geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r935315 - in /geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment: merge/annotation/ security/
Date Sun, 18 Apr 2010 08:36:22 GMT
Author: xuhaihong
Date: Sun Apr 18 08:36:22 2010
New Revision: 935315

URL: http://svn.apache.org/viewvc?rev=935315&view=rev
Log:
Revert the changes about supporting http-method-omission, I have some misunderstanding for
it

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/HTTPMethods.java
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/SpecSecurityBuilder.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java?rev=935315&r1=935314&r2=935315&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/merge/annotation/ServletSecurityAnnotationMergeHandler.java
Sun Apr 18 08:36:22 2010
@@ -31,7 +31,6 @@ import javax.servlet.annotation.ServletS
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.web25.deployment.merge.MergeContext;
 import org.apache.geronimo.web25.deployment.merge.webfragment.ServletMappingMergeHandler;
-import org.apache.geronimo.web25.deployment.security.HTTPMethods;
 import org.apache.geronimo.xbeans.javaee6.AuthConstraintType;
 import org.apache.geronimo.xbeans.javaee6.SecurityConstraintType;
 import org.apache.geronimo.xbeans.javaee6.ServletMappingType;
@@ -170,10 +169,6 @@ public class ServletSecurityAnnotationMe
         if (httpMethod == null || httpMethod.isEmpty()) {
             throw new DeploymentException("HTTP protocol method could not be null or empty
string in the ServletSecurity anntation of the class " + servletClassName);
         }
-        httpMethod = httpMethod.toUpperCase();
-        if (!HTTPMethods.SUPPORTED_HTTP_METHODS.contains(httpMethod)) {
-            throw new DeploymentException("Invalid HTTP protocol method " + httpMethod +
" in the ServletSecurity annotation of the class " + servletClassName);
-        }
         return httpMethod;
     }
 

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/HTTPMethods.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/HTTPMethods.java?rev=935315&r1=935314&r2=935315&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/HTTPMethods.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/HTTPMethods.java
Sun Apr 18 08:36:22 2010
@@ -20,7 +20,6 @@
 
 package org.apache.geronimo.web25.deployment.security;
 
-import java.util.Collections;
 import java.util.Set;
 import java.util.HashSet;
 import java.util.regex.Pattern;
@@ -32,20 +31,6 @@ import java.util.regex.Pattern;
  */
 public class HTTPMethods {
 
-    public static final Set<String> SUPPORTED_HTTP_METHODS;
-    static {
-        Set<String> supportedHttpMethods = new HashSet<String>();
-        supportedHttpMethods.add("OPTIONS");
-        supportedHttpMethods.add("GET");
-        supportedHttpMethods.add("HEAD");
-        supportedHttpMethods.add("POST");
-        supportedHttpMethods.add("PUT");
-        supportedHttpMethods.add("DELETE");
-        supportedHttpMethods.add("TRACE");
-        //supportedHttpMethods.add("CONNECT");
-        SUPPORTED_HTTP_METHODS = Collections.unmodifiableSet(supportedHttpMethods);
-    }
-
     private static final Pattern TOKEN_PATTERN = Pattern.compile("[!-~&&[^\\(\\)\\<\\>@,;:\\\\\"/\\[\\]\\?=\\{\\}]]*");
 
     private final Set<String> methods = new HashSet<String>();

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/SpecSecurityBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/SpecSecurityBuilder.java?rev=935315&r1=935314&r2=935315&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/SpecSecurityBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/security/SpecSecurityBuilder.java
Sun Apr 18 08:36:22 2010
@@ -118,8 +118,10 @@ public class SpecSecurityBuilder {
                     }
 
                     String[] httpMethodTypeArray = webResourceCollectionType.getHttpMethodArray();
-                    String[] omissionHttpMethods = webResourceCollectionType.getHttpMethodOmissionArray();
-                    if (httpMethodTypeArray.length > 0) {
+                    if (httpMethodTypeArray.length == 0) {
+                        pattern.addMethod("");
+                        allPattern.addMethod("");
+                    } else {
                         for (String aHttpMethodTypeArray : httpMethodTypeArray) {
                             String method = (aHttpMethodTypeArray == null ? null : aHttpMethodTypeArray.trim());
                             if (method != null) {
@@ -127,23 +129,7 @@ public class SpecSecurityBuilder {
                                 allPattern.addMethod(method);
                             }
                         }
-                    } else if (omissionHttpMethods.length > 0) {
-                        Set<String> httpMethods = new HashSet<String>(HTTPMethods.SUPPORTED_HTTP_METHODS);
-                        for (String omissionHttpMethod : omissionHttpMethods) {
-                            String nomalizedOmissionHttpMethod = omissionHttpMethod == null
? null : omissionHttpMethod.trim().toUpperCase();
-                            if (nomalizedOmissionHttpMethod != null) {
-                                httpMethods.remove(nomalizedOmissionHttpMethod);
-                            }
-                        }
-                        for (String httpMethod : httpMethods) {
-                            pattern.addMethod(httpMethod);
-                            allPattern.addMethod(httpMethod);
-                        }
-                    } else {
-                        pattern.addMethod("");
-                        allPattern.addMethod("");
                     }
-
                     if (currentPatterns == rolesPatterns) {
                         RoleNameType[] roleNameTypeArray = securityConstraintType.getAuthConstraint().getRoleNameArray();
                         for (RoleNameType roleNameType : roleNameTypeArray) {



Mime
View raw message