You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2010/01/26 16:57:31 UTC

svn commit: r903286 - /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java

Author: fmeschbe
Date: Tue Jan 26 15:57:30 2010
New Revision: 903286

URL: http://svn.apache.org/viewvc?rev=903286&view=rev
Log:
FELIX-2009 ensure console servlet is rebound to the HttpService only if required and also unbound with the old location and then bound with the new location

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java?rev=903286&r1=903285&r2=903286&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java Tue Jan 26 15:57:30 2010
@@ -853,10 +853,10 @@
         }
 
         // get the web manager root path
-        webManagerRoot = this.getProperty( config, PROP_MANAGER_ROOT, DEFAULT_MANAGER_ROOT );
-        if ( !webManagerRoot.startsWith( "/" ) )
+        String newWebManagerRoot = this.getProperty( config, PROP_MANAGER_ROOT, DEFAULT_MANAGER_ROOT );
+        if ( !newWebManagerRoot.startsWith( "/" ) )
         {
-            webManagerRoot = "/" + webManagerRoot;
+            newWebManagerRoot = "/" + newWebManagerRoot;
         }
 
         // get enabled plugins
@@ -881,13 +881,22 @@
         }
 
         // might update http service registration
-        HttpService httpService = this.httpService;
-        if ( httpService != null )
+        if ( !newWebManagerRoot.equals( this.webManagerRoot ) )
         {
-            synchronized ( this )
+            HttpService httpService = this.httpService;
+            if ( httpService != null )
             {
-                unbindHttpService( httpService );
-                bindHttpService( httpService );
+                synchronized ( this )
+                {
+                    // unbind old location first
+                    unbindHttpService( httpService );
+
+                    // switch location
+                    this.webManagerRoot = newWebManagerRoot;
+
+                    // bind new location now
+                    bindHttpService( httpService );
+                }
             }
         }
     }