Author: hansbak
Date: Mon Nov 22 07:55:56 2010
New Revision: 1037624
URL:
http://svn.apache.org/viewvc?rev=1037624&view=revLog:
small adjustment fo multitenant, redirecting url in jsp did not work properly
Modified:
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
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=1037624&r1=1037623&r2=1037624&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 Mon Nov 22 07:55:56 2010
@@ -283,9 +283,7 @@ public class ContextFilter implements Fi
try {
// if tenant was specified, replace delegator with the new per-tenant delegator and set tenantId to session attribute
Delegator delegator = getDelegator(config.getServletContext());
- List<EntityCondition> conds = FastList.newInstance();
- conds.add(EntityCondition.makeCondition("domainName", serverName));
- List<GenericValue> tenants = delegator.findList("Tenant", EntityCondition.makeCondition(conds), null, UtilMisc.toList("-createdStamp"), null, false);
+ List<GenericValue> tenants = delegator.findList("Tenant", EntityCondition.makeCondition("domainName", serverName), null, UtilMisc.toList("-createdStamp"), null, false);
if (UtilValidate.isNotEmpty(tenants)) {
GenericValue tenant = EntityUtil.getFirst(tenants);
String tenantId = tenant.getString("tenantId");
@@ -299,7 +297,6 @@ public class ContextFilter implements Fi
// make that tenant active, setup a new delegator and a new dispatcher
String tenantDelegatorName = delegator.getDelegatorBaseName() + "#" + tenantId;
- httpRequest.getSession().setAttribute("delegatorName", tenantDelegatorName);
// after this line the delegator is replaced with the new per-tenant delegator
delegator = DelegatorFactory.getDelegator(tenantDelegatorName);
@@ -323,6 +320,9 @@ public class ContextFilter implements Fi
request.setAttribute("tenantId", tenantId);
}
+
+ // always put delegator's name to the session
+ httpRequest.getSession().setAttribute("delegatorName", delegator.getDelegatorName());
} catch (GenericEntityException e) {
Debug.logWarning(e, "Unable to get Tenant", module);
}