Hi Scott,

I must say I'm not quite sure. I wondered also and wanted to revert it all.
At 1st place Sascha tried to improve by using WebSiteWorker.getWebSiteId. But, 
as you certainly now it introduced an UTF-8 quirk.
I was very busy and forgot to ask Sascha why he did so, it's done, waiting his 
answer...

Jacques

Scott Gray wrote:
Hi Jacques,

So it looks like we've gone from having (before any of this):
httpRequest.getSession().setAttribute("webSiteId", 
config.getServletContext().getAttribute("webSiteId"));

To having:
if (UtilValidate.isEmpty(httpRequest.getSession().getAttribute("webSiteId"))){
    httpRequest.getSession().setAttribute("webSiteId", 
config.getServletContext().getAttribute("webSiteId"));
}

Could you tell me what the problem was with what we originally had and how what 
we have now improves on that?

Thanks
Scott

On 18/06/2010, at 3:18 AM, [email protected] wrote:

Author: jleroux
Date: Thu Jun 17 15:18:48 2010
New Revision: 955631

URL: http://svn.apache.org/viewvc?rev=955631&view=rev
Log:
A patch from Sascha Rodekamp "Set webside Id in context filter" 
(https://issues.apache.org/jira/browse/OFBIZ-3801) - OFBIZ-3801

Very minor: a better way to write the webSiteId in the Session (2d try ;o)

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=955631&r1=955630&r2=955631&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 
Thu Jun 17 15:18:48 2010 @@ -62,7 +62,6 @@ import
org.ofbiz.security.authz.Authoriz
import org.ofbiz.security.authz.AuthorizationFactory;
import org.ofbiz.service.GenericDispatcher;
import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.webapp.website.WebSiteWorker;

/**
 * ContextFilter - Restricts access to raw files and configures servlet objects.
@@ -134,12 +133,14 @@ public class ContextFilter implements Fi
            
Thread.currentThread().setContextClassLoader(localCachedClassLoader);
        }

-        // set the webSiteId in the session
-        httpRequest.getSession().setAttribute("webSiteId", 
WebSiteWorker.getWebSiteId(httpRequest));
-
        // set the ServletContext in the request for future use
        request.setAttribute("servletContext", config.getServletContext());

+        // set the webSiteId in the session
+        if 
(UtilValidate.isEmpty(httpRequest.getSession().getAttribute("webSiteId"))){
+            httpRequest.getSession().setAttribute("webSiteId", 
config.getServletContext().getAttribute("webSiteId"));
+        }
+
        // set the filesystem path of context root.
request.setAttribute("_CONTEXT_ROOT_", config.getServletContext().getRealPath("/"));


Reply via email to