tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r920410 - /tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
Date Mon, 08 Mar 2010 17:22:33 GMT
Author: markt
Date: Mon Mar  8 17:22:33 2010
New Revision: 920410

URL: http://svn.apache.org/viewvc?rev=920410&view=rev
Log:
Use the Lifecycle state to dtermine if the context is in the correct state to allow configuration

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=920410&r1=920409&r2=920410&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Mon Mar  8 17:22:33
2010
@@ -61,6 +61,7 @@
 import org.apache.catalina.Context;
 import org.apache.catalina.Engine;
 import org.apache.catalina.Host;
+import org.apache.catalina.LifecycleState;
 import org.apache.catalina.Service;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.connector.Connector;
@@ -887,7 +888,7 @@
     private FilterRegistration.Dynamic addFilter(String filterName,
             String filterClass, Filter filter) throws IllegalStateException {
         
-        if (context.initialized) {
+        if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
             //TODO Spec breaking enhancement to ignore this restriction
             throw new IllegalStateException(
                     sm.getString("applicationContext.addFilter.ise",
@@ -1016,7 +1017,7 @@
     private ServletRegistration.Dynamic addServlet(String servletName,
             String servletClass, Servlet servlet) throws IllegalStateException {
         
-        if (context.initialized) {
+        if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
             //TODO Spec breaking enhancement to ignore this restriction
             throw new IllegalStateException(
                     sm.getString("applicationContext.addServlet.ise",
@@ -1145,7 +1146,7 @@
     public void setSessionTrackingModes(
             Set<SessionTrackingMode> sessionTrackingModes) {
 
-        if (context.getAvailable()) {
+        if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
             throw new IllegalStateException(
                     sm.getString("applicationContext.setSessionTracking.ise",
                             getContextPath()));
@@ -1230,7 +1231,7 @@
 
     @Override
     public <T extends EventListener> void addListener(T t) {
-        if (context.getAvailable()) {
+        if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
             throw new IllegalStateException(
                     sm.getString("applicationContext.addListener.ise",
                             getContextPath()));
@@ -1300,7 +1301,7 @@
     @Override
     public void declareRoles(String... roleNames) {
         
-        if (context.initialized) {
+        if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
             //TODO Spec breaking enhancement to ignore this restriction
             throw new IllegalStateException(
                     sm.getString("applicationContext.addRole.ise",



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message