Browse Source

Added webAppRootKey context-param to samples to prevent conflicts when run together in Tomcat.

Luke Taylor 16 năm trước cách đây
mục cha
commit
7fa9a959b5

+ 35 - 30
samples/cas/client/src/main/webapp/WEB-INF/web.xml

@@ -12,61 +12,66 @@
     <display-name>Spring Security CAS Demo Application</display-name>
     <display-name>Spring Security CAS Demo Application</display-name>
 
 
     <!--
     <!--
-	  - Location of the XML file that defines the root application context
-	  - Applied by ContextLoaderListener.
-	  -->
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
-		<param-value>
-			/WEB-INF/applicationContext-security.xml
-		</param-value>
-	</context-param>
+      - Location of the XML file that defines the root application context
+      - Applied by ContextLoaderListener.
+      -->
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            /WEB-INF/applicationContext-security.xml
+        </param-value>
+    </context-param>
 
 
     <context-param>
     <context-param>
         <param-name>log4jConfigLocation</param-name>
         <param-name>log4jConfigLocation</param-name>
         <param-value>/WEB-INF/classes/log4j.properties</param-value>
         <param-value>/WEB-INF/classes/log4j.properties</param-value>
     </context-param>
     </context-param>
 
 
-	<filter>
-	   <filter-name>CAS Single Sign Out Filter</filter-name>
-	   <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
-	</filter>
+    <context-param>
+        <param-name>webAppRootKey</param-name>
+        <param-value>cas.root</param-value>
+    </context-param>
+
+    <filter>
+       <filter-name>CAS Single Sign Out Filter</filter-name>
+       <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
+    </filter>
 
 
     <filter>
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
     </filter>
     </filter>
 
 
-	<filter-mapping>
-	   <filter-name>CAS Single Sign Out Filter</filter-name>
-	   <url-pattern>/*</url-pattern>
-	</filter-mapping>
+    <filter-mapping>
+       <filter-name>CAS Single Sign Out Filter</filter-name>
+       <url-pattern>/*</url-pattern>
+    </filter-mapping>
 
 
     <filter-mapping>
     <filter-mapping>
       <filter-name>springSecurityFilterChain</filter-name>
       <filter-name>springSecurityFilterChain</filter-name>
       <url-pattern>/*</url-pattern>
       <url-pattern>/*</url-pattern>
     </filter-mapping>
     </filter-mapping>
 
 
-	<!--
-	  - Loads the root application context of this web app at startup.
-	  - The application context is then available via
-	  - WebApplicationContextUtils.getWebApplicationContext(servletContext).
+    <!--
+      - Loads the root application context of this web app at startup.
+      - The application context is then available via
+      - WebApplicationContextUtils.getWebApplicationContext(servletContext).
     -->
     -->
-	<listener>
-		<listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
-	</listener>
+    <listener>
+        <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
+    </listener>
 
 
-	<listener>
-		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
 
 
     <listener>
     <listener>
         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
-    </listener>    
+    </listener>
 
 
     <!--
     <!--
-	  - Publishes events for session creation and destruction through the application
-	  - context. Optional unless concurrent session control is being used.
+      - Publishes events for session creation and destruction through the application
+      - context. Optional unless concurrent session control is being used.
       -->
       -->
     <listener>
     <listener>
       <listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>
       <listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>

+ 60 - 56
samples/contacts/src/main/webapp/WEB-INF/web.xml

@@ -12,26 +12,30 @@
 
 
     <display-name>Contacts Sample Application</display-name>
     <display-name>Contacts Sample Application</display-name>
 
 
-	<!--
-	  - Location of the XML file that defines the root application context
-	  - Applied by ContextLoaderListener.
-	  -->
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
-		<param-value>
-			/WEB-INF/applicationContext-security.xml
-			classpath:applicationContext-common-business.xml
-			classpath:applicationContext-common-authorization.xml
-		</param-value>
-	</context-param>
+    <!--
+      - Location of the XML file that defines the root application context
+      - Applied by ContextLoaderListener.
+      -->
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            /WEB-INF/applicationContext-security.xml
+            classpath:applicationContext-common-business.xml
+            classpath:applicationContext-common-authorization.xml
+        </param-value>
+    </context-param>
 
 
    <!-- Nothing below here needs to be modified -->
    <!-- Nothing below here needs to be modified -->
 
 
-	<context-param>
-		<param-name>log4jConfigLocation</param-name>
-		<param-value>/WEB-INF/classes/log4j.properties</param-value>
-	</context-param>
+    <context-param>
+        <param-name>log4jConfigLocation</param-name>
+        <param-value>/WEB-INF/classes/log4j.properties</param-value>
+    </context-param>
 
 
+    <context-param>
+        <param-name>webAppRootKey</param-name>
+        <param-value>contacts.root</param-value>
+    </context-param>
 
 
     <filter>
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-name>springSecurityFilterChain</filter-name>
@@ -43,18 +47,18 @@
       <url-pattern>/*</url-pattern>
       <url-pattern>/*</url-pattern>
     </filter-mapping>
     </filter-mapping>
 
 
-	<!--
-	  - Loads the root application context of this web app at startup.
-	  - The application context is then available via
-	  - WebApplicationContextUtils.getWebApplicationContext(servletContext).
+    <!--
+      - Loads the root application context of this web app at startup.
+      - The application context is then available via
+      - WebApplicationContextUtils.getWebApplicationContext(servletContext).
     -->
     -->
-	<listener>
-		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
 
 
-	<listener>
-		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
-	</listener>
+    <listener>
+        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+    </listener>
 
 
     <!--
     <!--
         The HttpSessionEventPublisher will publish
         The HttpSessionEventPublisher will publish
@@ -66,40 +70,40 @@
     </listener>
     </listener>
 
 
   <!--
   <!--
-	- Provides core MVC application controller. See contacts-servlet.xml.
+    - Provides core MVC application controller. See contacts-servlet.xml.
     -->
     -->
-	<servlet>
-		<servlet-name>contacts</servlet-name>
-		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
+    <servlet>
+        <servlet-name>contacts</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
 
 
   <!--
   <!--
     - Provides web services endpoint. See remoting-servlet.xml.
     - Provides web services endpoint. See remoting-servlet.xml.
     -->
     -->
-	<servlet>
-		<servlet-name>remoting</servlet-name>
-		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-		<load-on-startup>2</load-on-startup>
-	</servlet>
-
-	<servlet-mapping>
-    	<servlet-name>contacts</servlet-name>
-    	<url-pattern>*.htm</url-pattern>
- 	</servlet-mapping>
-
-	<servlet-mapping>
-		<servlet-name>remoting</servlet-name>
-		<url-pattern>/remoting/*</url-pattern>
-	</servlet-mapping>
-
- 	<welcome-file-list>
-		<welcome-file>index.jsp</welcome-file>
-	</welcome-file-list>
-
-	<error-page>
-		<error-code>403</error-code>
-		<location>/error.html</location>
-	</error-page>
+    <servlet>
+        <servlet-name>remoting</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>2</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>contacts</servlet-name>
+        <url-pattern>*.htm</url-pattern>
+     </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>remoting</servlet-name>
+        <url-pattern>/remoting/*</url-pattern>
+    </servlet-mapping>
+
+     <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+
+    <error-page>
+        <error-code>403</error-code>
+        <location>/error.html</location>
+    </error-page>
 
 
 </web-app>
 </web-app>

+ 5 - 0
samples/ldap/src/main/webapp/WEB-INF/web.xml

@@ -22,6 +22,11 @@
         </param-value>
         </param-value>
     </context-param>
     </context-param>
 
 
+    <context-param>
+        <param-name>webAppRootKey</param-name>
+        <param-value>ldap.root</param-value>
+    </context-param>
+
     <filter>
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

+ 2 - 11
sandbox/heavyduty/src/main/webapp/WEB-INF/classes/log4j.properties

@@ -1,19 +1,10 @@
 # Global logging configuration
 # Global logging configuration
 log4j.rootLogger=DEBUG, stdout
 log4j.rootLogger=DEBUG, stdout
 
 
-log4j.logger.org.springframework.security=DEBUG, stdout
-log4j.logger.org.apache.directory=INFO, stdout
+log4j.logger.org.springframework.security=DEBUG
+log4j.logger.org.apache.directory=INFO
 
 
 # Console output...
 # Console output...
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.conversionPattern=[%p,%c{1},%L] - %m%n
 log4j.appender.stdout.layout.conversionPattern=[%p,%c{1},%L] - %m%n
-
-# Rolling log file output...
-#log4j.appender.fileout=org.apache.log4j.RollingFileAppender
-#log4j.appender.fileout.File=spring-security-tutorial.log
-#log4j.appender.fileout.File=${webapp.root}/WEB-INF/log4j.log
-#log4j.appender.fileout.MaxFileSize=1024KB
-#log4j.appender.fileout.MaxBackupIndex=1
-#log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
-#log4j.appender.fileout.layout.conversionPattern=%d{ABSOLUTE} %5p %c{1},%t:%L - %m%n

+ 41 - 36
sandbox/heavyduty/src/main/webapp/WEB-INF/web.xml

@@ -10,24 +10,29 @@
   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
 
 
     <display-name>Spring Security Tutorial Application</display-name>
     <display-name>Spring Security Tutorial Application</display-name>
-    
+
     <!--
     <!--
-	  - Location of the XML file that defines the root application context
-	  - Applied by ContextLoaderListener.
-	  -->
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
-		<param-value>
-			classpath:applicationContext-business.xml
-			/WEB-INF/appContext-persistence.xml
-			/WEB-INF/appContext-security.xml
-		</param-value>
-	</context-param>
-	
+      - Location of the XML file that defines the root application context
+      - Applied by ContextLoaderListener.
+      -->
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            classpath:applicationContext-business.xml
+            /WEB-INF/appContext-persistence.xml
+            /WEB-INF/appContext-security.xml
+        </param-value>
+    </context-param>
+
     <context-param>
     <context-param>
         <param-name>log4jConfigLocation</param-name>
         <param-name>log4jConfigLocation</param-name>
         <param-value>/WEB-INF/classes/log4j.properties</param-value>
         <param-value>/WEB-INF/classes/log4j.properties</param-value>
-    </context-param>	
+    </context-param>
+
+    <context-param>
+        <param-name>webAppRootKey</param-name>
+        <param-value>heavyduty.root</param-value>
+    </context-param>
 
 
     <filter>
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-name>springSecurityFilterChain</filter-name>
@@ -43,39 +48,39 @@
         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
     </listener>
     </listener>
 
 
-	<!--
-	  - Loads the root application context of this web app at startup.
-	  - The application context is then available via
-	  - WebApplicationContextUtils.getWebApplicationContext(servletContext).
+    <!--
+      - Loads the root application context of this web app at startup.
+      - The application context is then available via
+      - WebApplicationContextUtils.getWebApplicationContext(servletContext).
     -->
     -->
-	<listener>
-		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
 
 
-	<!--
-	  - Publishes events for session creation and destruction through the application
-	  - context. Optional unless concurrent session control is being used.
+    <!--
+      - Publishes events for session creation and destruction through the application
+      - context. Optional unless concurrent session control is being used.
       -->
       -->
     <listener>
     <listener>
         <listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>
         <listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>
     </listener>
     </listener>
 
 
   <!--
   <!--
-	- Provides core MVC application controller.
+    - Provides core MVC application controller.
     -->
     -->
-	<servlet>
-		<servlet-name>heavyduty</servlet-name>
-		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
+    <servlet>
+        <servlet-name>heavyduty</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
 
 
-	<servlet-mapping>
-    	<servlet-name>heavyduty</servlet-name>
-    	<url-pattern>*.htm</url-pattern>
- 	</servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>heavyduty</servlet-name>
+        <url-pattern>*.htm</url-pattern>
+     </servlet-mapping>
 
 
      <welcome-file-list>
      <welcome-file-list>
-		<welcome-file>index.jsp</welcome-file>
-	</welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
 
 
 </web-app>
 </web-app>