svn commit: r1032896 - in /ofbiz/trunk/framework: catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java webapp/src/org/ofbiz/webapp/control/ContextFilter.java webapp/src/org/ofbiz/webapp/control/TenantServlet.java

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

svn commit: r1032896 - in /ofbiz/trunk/framework: catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java webapp/src/org/ofbiz/webapp/control/ContextFilter.java webapp/src/org/ofbiz/webapp/control/TenantServlet.java

hansbak-2
Author: hansbak
Date: Tue Nov  9 09:14:33 2010
New Revision: 1032896

URL: http://svn.apache.org/viewvc?rev=1032896&view=rev
Log:
removing the tenant servlet because that gave a problem with the root mountpoint defined twice in systems which already use the root mount point

Removed:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/TenantServlet.java
Modified:
    ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.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=1032896&r1=1032895&r2=1032896&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 Tue Nov  9 09:14:33 2010
@@ -621,43 +621,6 @@ public class CatalinaContainer implement
         return context;
     }
 
-    protected Context createTenantContext() throws ContainerException {
-        String server = "default-server";
-        Engine engine = engines.get(server);
-        if (engine == null) {
-            Debug.logWarning("Server with name [" + server + "] not found;", module);
-            return null;
-        }
-        
-        // create the web application context
-        StandardContext context = (StandardContext) embedded.createContext("/", System.getProperty("ofbiz.home"));
-        context.setJ2EEApplication(J2EE_APP);
-        context.setJ2EEServer(J2EE_SERVER);
-        context.setLoader(embedded.createLoader(ClassLoaderContainer.getClassLoader()));
-        context.setReloadable(contextReloadable);
-        context.setDistributable(distribute);
-        context.setCrossContext(crossContext);
-
-        
-        // create the Default Servlet instance to mount
-        StandardWrapper defaultServlet = new StandardWrapper();
-        defaultServlet.setServletClass("org.ofbiz.webapp.control.TenantServlet");
-        defaultServlet.setServletName("default");
-        defaultServlet.setLoadOnStartup(1);
-        defaultServlet.addInitParameter("debug", "0");
-        defaultServlet.addInitParameter("listing", "true");
-        defaultServlet.addMapping("/");
-        context.addChild(defaultServlet);
-        context.addServletMapping("/", "default");
-
-        Host host = hosts.get(engine.getName() + "._DEFAULT");
-        context.setRealm(host.getRealm());
-        host.addChild(context);
-        context.getMapper().setDefaultHostName(host.getName());
-
-        return context;
-    }
-
     protected void loadComponents() throws ContainerException {
         if (embedded == null) {
             throw new ContainerException("Cannot load web applications without Embedded instance!");
@@ -679,12 +642,6 @@ public class CatalinaContainer implement
                 }
             }
         }
-
-        // if the multitenant is enabled then create the tenant context
-        String useMultitenant = UtilProperties.getPropertyValue("general.properties", "multitenant");
-        if ("Y".equals(useMultitenant) && UtilValidate.isEmpty(delegator.getDelegatorTenantId())) {
-            createTenantContext();
-        }
     }
 
     public void stop() throws ContainerException {

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1032896&r1=1032895&r2=1032896&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Tue Nov  9 09:14:33 2010
@@ -288,6 +288,12 @@ public class ContextFilter implements Fi
                     GenericValue tenant = EntityUtil.getFirst(tenants);
                     String tenantId = tenant.getString("tenantId");
                     
+                    // if the request URI is "/control/main" then redirect to the initial path
+                    if (httpRequest.getRequestURI().startsWith("/control/main")) {
+                        String initialPath = tenant.getString("initialPath");
+                        ((HttpServletResponse)response).sendRedirect(initialPath);
+                    }
+                    
                     // make that tenant active, setup a new delegator and a new dispatcher
                     String tenantDelegatorName = delegator.getDelegatorBaseName() + "#" + tenantId;
                     httpRequest.getSession().setAttribute("delegatorName", tenantDelegatorName);