svn commit: r1141284 - /ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1141284 - /ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java

doogie-3
Author: doogie
Date: Wed Jun 29 22:12:08 2011
New Revision: 1141284

URL: http://svn.apache.org/viewvc?rev=1141284&view=rev
Log:
OPTIMIZE: Rework part of createContext(), so that the host<->context
connection happens in one place.

Modified:
    ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java

Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1141284&r1=1141283&r2=1141284&view=diff
==============================================================================
--- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
+++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Wed Jun 29 22:12:08 2011
@@ -589,18 +589,16 @@ public class CatalinaContainer implement
             context.addParameter(entry.getKey(), entry.getValue());
         }
 
+        Host host;
         if (UtilValidate.isEmpty(virtualHosts)) {
-            Host host = hosts.get(engine.getName() + "._DEFAULT");
-            context.setRealm(host.getRealm());
-            host.addChild(context);
-            context.getMapper().setDefaultHostName(host.getName());
+            host = hosts.get(engine.getName() + "._DEFAULT");
         } else {
             // assume that the first virtual-host will be the default; additional virtual-hosts will be aliases
             Iterator<String> vhi = virtualHosts.iterator();
             String hostName = vhi.next();
 
             boolean newHost = false;
-            Host host = hosts.get(engine.getName() + "." + hostName);
+            host = hosts.get(engine.getName() + "." + hostName);
             if (host == null) {
                 host = createHost(engine, hostName);
                 newHost = true;
@@ -608,14 +606,14 @@ public class CatalinaContainer implement
             while (vhi.hasNext()) {
                 host.addAlias(vhi.next());
             }
-            context.setRealm(host.getRealm());
-            host.addChild(context);
-            context.getMapper().setDefaultHostName(host.getName());
 
             if (newHost) {
                 hosts.put(engine.getName() + "." + hostName, host);
             }
         }
+        context.setRealm(host.getRealm());
+        host.addChild(context);
+        context.getMapper().setDefaultHostName(host.getName());
 
         return context;
     }