[jboss-cvs] JBossAS SVN: r111877 - in branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat: service/deployers and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 28 15:18:49 EDT 2011


Author: dehort
Date: 2011-07-28 15:18:49 -0400 (Thu, 28 Jul 2011)
New Revision: 111877

Modified:
   branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java
   branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
   branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java
Log:
Merging in a fix for JBossWebRealm.hasRole throwing a NullPointerException
[JBPAPP-6728]


Modified: branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java
===================================================================
--- branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java	2011-07-28 18:41:57 UTC (rev 111876)
+++ branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/security/JaccContextValve.java	2011-07-28 19:18:49 UTC (rev 111877)
@@ -73,7 +73,6 @@
    { 
       SecurityAssociationValve.activeWebMetaData.set(metaData);
       activeCS.set(warCS);
-      HttpServletRequest httpRequest = (HttpServletRequest) request.getRequest();
 
       //Set the customized rolename-principalset mapping in jboss-app.xml
       Map<String, Set<String>> principalToRoleSetMap = metaData.getPrincipalVersusRolesMap();
@@ -85,24 +84,15 @@
       {
          // Set the JACC context id
          PolicyContext.setContextID(contextID);
-         // Set the JACC HttpServletRequest PolicyContextHandler data
-         HttpServletRequestPolicyContextHandler.setRequest(httpRequest);
-         if(ActiveRequestResponseCacheValve.activeRequest.get() == null)
-        	 ActiveRequestResponseCacheValve.activeRequest.set(request);
-         if(ActiveRequestResponseCacheValve.activeResponse.get() == null)
-        	 ActiveRequestResponseCacheValve.activeResponse.set(response);
          // Perform the request
          getNext().invoke(request, response);
       }
       finally
       {
          SecurityAssociationValve.activeWebMetaData.set(null);
-         ActiveRequestResponseCacheValve.activeRequest.set(null);
-         ActiveRequestResponseCacheValve.activeResponse.set(null);
          SecurityAssociationActions.clear();
          activeCS.set(null);
          SecurityRolesAssociation.setSecurityRoles(null);
-         HttpServletRequestPolicyContextHandler.setRequest(null); 
       }
    }
 
@@ -111,7 +101,6 @@
    {
       SecurityAssociationValve.activeWebMetaData.set(metaData);
       activeCS.set(warCS);
-      HttpServletRequest httpRequest = (HttpServletRequest) request.getRequest();
 
       //Set the customized rolename-principalset mapping in jboss-app.xml
       Map<String, Set<String>> principalToRoleSetMap = metaData.getPrincipalVersusRolesMap();
@@ -123,25 +112,16 @@
       {
          // Set the JACC context id
          PolicyContext.setContextID(contextID);
-         // Set the JACC HttpServletRequest PolicyContextHandler data
-         HttpServletRequestPolicyContextHandler.setRequest(httpRequest);
-         if(ActiveRequestResponseCacheValve.activeRequest.get() == null)
-        	 ActiveRequestResponseCacheValve.activeRequest.set(request);
-         if(ActiveRequestResponseCacheValve.activeResponse.get() == null)
-        	 ActiveRequestResponseCacheValve.activeResponse.set(response);
          // Perform the request
          getNext().event(request, response, event);
       }
       finally
       {
          SecurityAssociationValve.activeWebMetaData.set(null);
-         ActiveRequestResponseCacheValve.activeRequest.set(null);
-         ActiveRequestResponseCacheValve.activeResponse.set(null);
          SecurityAssociationActions.clear();
          activeCS.set(null);
          SecurityRolesAssociation.setSecurityRoles(null);
-         HttpServletRequestPolicyContextHandler.setRequest(null); 
       }
    }
    
-}
\ No newline at end of file
+}

Modified: branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2011-07-28 18:41:57 UTC (rev 111876)
+++ branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java	2011-07-28 19:18:49 UTC (rev 111877)
@@ -284,14 +284,6 @@
       if (metaDataSecurityDomain != null)
          metaDataSecurityDomain = metaDataSecurityDomain.trim();
       
-      //Add a valve to cache the active request/response
-      Engine engine = this.getCatalinaEngine(context);
-      if(engine != null)
-      {
-    	  ActiveRequestResponseCacheValve activeReqValve = new ActiveRequestResponseCacheValve();
-    	  engine.getPipeline().addValve(activeReqValve); 
-      }
-
       // Add a valve to establish security context
       SecurityContextEstablishmentValve scevalve = new SecurityContextEstablishmentValve(metaDataSecurityDomain, SecurityUtil.unprefixSecurityDomain(config
             .getDefaultSecurityDomain()), SecurityActions.loadClass(config.getSecurityContextClassName()), getSecurityManagement());

Modified: branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java
===================================================================
--- branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java	2011-07-28 18:41:57 UTC (rev 111876)
+++ branches/JBPAPP_5_1/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatService.java	2011-07-28 19:18:49 UTC (rev 111877)
@@ -63,6 +63,7 @@
 import org.jboss.web.tomcat.metadata.ServiceMetaData;
 import org.jboss.web.tomcat.metadata.ValveMetaData;
 import org.jboss.web.tomcat.security.HttpServletRequestPolicyContextHandler;
+import org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve;
 import org.jboss.xb.binding.Unmarshaller;
 import org.jboss.xb.binding.UnmarshallerFactory;
 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
@@ -260,6 +261,7 @@
             engine.setJvmRoute(StringPropertyReplacer.replaceProperties(engineMetaData.getJvmRoute()));
          }
          //engine.setJvmRoute(engineMetaData.getJvmRoute());
+         engine.getPipeline().addValve(new ActiveRequestResponseCacheValve());
          engine.setDefaultHost(engineMetaData.getDefaultHost());
          service.setContainer(engine);
          



More information about the jboss-cvs-commits mailing list