Skip to content
This repository was archived by the owner on May 9, 2020. It is now read-only.

Commit a61bc86

Browse files
committed
"Applied fix from trunk for revision: 1353681 "
------------------------------------------------------------------------ r1353681 | jacopoc | 2012-06-25 19:46:07 +0200 (lun., 25 juin 2012) | 8 lines Cleaned up some code that was adding the delegator/dispatcher/security/auth objects in the user session rather than the request; 1) removed the request-maps for changeDelegator from components' controller.xml files: they were not used 2) removed CoreEvents.changeDelegator(...): not used (apart from the request-maps removed at #1) 3) removed CoreEvents.changeDispatcher(...): not used 4) cleaned up some code (related to multitenant development): now the objects are set in the request rather than the session PS: as a consequence this will also fix the issue reported in OFBIZ-4289 ------------------------------------------------------------------------ � git-svn-id: https://svn.apache.org/repos/asf/ofbiz/branches/release12.04@1358545 13f79535-47bb-0310-9956-ffa450edef68
1 parent 7a0b8ad commit a61bc86

File tree

13 files changed

+16
-175
lines changed

13 files changed

+16
-175
lines changed

applications/accounting/webapp/accounting/WEB-INF/controller.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ under the License.
4242
<response name="success" type="request" value="main"/>
4343
</request-map>
4444

45-
<request-map uri="changeDelegator">
46-
<event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
47-
<response name="success" type="view" value="main"/>
48-
<response name="error" type="view" value="error"/>
49-
</request-map>
50-
5145
<request-map uri="main">
5246
<security https="true" auth="true"/>
5347
<response name="success" type="view" value="main"/>

applications/content/webapp/content/WEB-INF/controller.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ under the License.
5252
<response name="success" type="view" value="fonts.fo"/>
5353
</request-map>
5454

55-
<request-map uri="changeDelegator">
56-
<security https="true" auth="true"/>
57-
<event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
58-
<response name="success" type="view" value="main"/>
59-
<response name="error" type="view" value="error"/>
60-
</request-map>
61-
6255
<!-- ================ Blog Requests ================= -->
6356
<request-map uri="blogMain">
6457
<security https="true" auth="true"/>

applications/humanres/webapp/humanres/WEB-INF/controller.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ under the License.
4646
<response name="success" type="request" value="main"/>
4747
</request-map>
4848

49-
<request-map uri="changeDelegator">
50-
<event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
51-
<response name="success" type="view" value="main"/>
52-
<response name="error" type="view" value="error"/>
53-
</request-map>
54-
5549
<request-map uri="main">
5650
<security https="true" auth="true"/>
5751
<response name="success" type="view" value="main"/>

applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ under the License.
4646
<response name="success" type="request" value="main"/>
4747
</request-map>
4848

49-
<request-map uri="changeDelegator">
50-
<event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
51-
<response name="success" type="view" value="main"/>
52-
<response name="error" type="view" value="error"/>
53-
</request-map>
54-
5549
<request-map uri="main">
5650
<security https="true" auth="true"/>
5751
<response name="success" type="view" value="main"/>

applications/marketing/webapp/marketing/WEB-INF/controller.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ under the License.
4545
<request-map uri="view"><security https="true" auth="false"/><response name="success" type="request" value="main"/></request-map>
4646
<request-map uri="main"><security https="true" auth="true"/><response name="success" type="view" value="main"/></request-map>
4747

48-
<request-map uri="changeDelegator">
49-
<security https="true" auth="true"/>
50-
<event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
51-
<response name="success" type="view" value="main"/>
52-
<response name="error" type="view" value="error"/>
53-
</request-map>
54-
5548
<!-- =========== DataSource =========== -->
5649
<request-map uri="FindDataSource"><security https="true" auth="true"/><response name="success" type="view" value="FindDataSource"/></request-map>
5750
<request-map uri="EditDataSource"><security https="true" auth="true"/><response name="success" type="view" value="EditDataSource"/></request-map>

applications/product/webapp/catalog/WEB-INF/controller.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ under the License.
6363
<response name="success" type="view" value="FastLoadCache"/>
6464
</request-map>
6565

66-
<request-map uri="changeDelegator">
67-
<security https="true" auth="true"/>
68-
<event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
69-
<response name="success" type="view" value="main"/>
70-
<response name="error" type="view" value="error"/>
71-
</request-map>
72-
7366
<request-map uri="advancedsearch">
7467
<security https="true" auth="true"/>
7568
<response name="success" type="view" value="advancedsearch"/>

applications/workeffort/webapp/workeffort/WEB-INF/controller.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ under the License.
3939

4040
<!-- Request Mappings -->
4141

42-
<request-map uri="changeDelegator">
43-
<event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
44-
<response name="success" type="view" value="main"/>
45-
<response name="error" type="view" value="error"/>
46-
</request-map>
47-
4842
<request-map uri="view">
4943
<security https="true" auth="true"/>
5044
<response name="success" type="view" value="main"/>

framework/bi/webapp/bi/WEB-INF/controller.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@
3030
<response name="success" type="view" value="main"/>
3131
</request-map>
3232

33-
<request-map uri="changeDelegator">
34-
<event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
35-
<response name="success" type="view" value="main"/>
36-
<response name="error" type="view" value="error"/>
37-
</request-map>
38-
3933
<request-map uri="main">
4034
<security https="true" auth="true"/>
4135
<response name="success" type="view" value="main"/>

framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
317317
LocalDispatcher dispatcher = getDispatcher(config.getServletContext());
318318

319319
// set web context objects
320-
httpRequest.getSession().setAttribute("dispatcher", dispatcher);
321-
httpRequest.getSession().setAttribute("security", security);
320+
request.setAttribute("dispatcher", dispatcher);
321+
request.setAttribute("security", security);
322322

323-
httpRequest.setAttribute("tenantId", tenantId);
323+
request.setAttribute("tenantId", tenantId);
324324
}
325325

326326
// NOTE DEJ20101130: do NOT always put the delegator name in the user's session because the user may

framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -474,35 +474,30 @@ public static String login(HttpServletRequest request, HttpServletResponse respo
474474
return "error";
475475
}
476476
}
477+
477478
private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) {
478479
HttpSession session = request.getSession();
479-
480-
// NOTE: we do NOT want to set this in the servletContet, only in the request and session
481-
session.setAttribute("delegatorName", delegator.getDelegatorName());
482-
483-
request.setAttribute("delegator", delegator);
484-
session.setAttribute("delegator", delegator);
485-
486-
request.setAttribute("dispatcher", dispatcher);
487-
session.setAttribute("dispatcher", dispatcher);
488-
489-
// we also need to setup the security and authz objects since they are dependent on the delegator
480+
// NOTE: we do NOT want to set this in the servletContext, only in the request and session
481+
// We also need to setup the security and authz objects since they are dependent on the delegator
482+
Security security = null;
490483
try {
491-
Security security = SecurityFactory.getInstance(delegator);
492-
request.setAttribute("security", security);
493-
session.setAttribute("security", security);
484+
security = SecurityFactory.getInstance(delegator);
494485
} catch (SecurityConfigurationException e) {
495486
Debug.logError(e, module);
496487
}
497-
488+
Authorization authz = null;
498489
try {
499-
Authorization authz = AuthorizationFactory.getInstance(delegator);
500-
request.setAttribute("authz", authz);
501-
session.setAttribute("authz", authz);
490+
authz = AuthorizationFactory.getInstance(delegator);
502491
} catch (SecurityConfigurationException e) {
503492
Debug.logError(e, module);
504493
}
505494

495+
session.setAttribute("delegatorName", delegator.getDelegatorName());
496+
request.setAttribute("delegator", delegator);
497+
request.setAttribute("dispatcher", dispatcher);
498+
request.setAttribute("security", security);
499+
request.setAttribute("authz", authz);
500+
506501
// get rid of the visit info since it was pointing to the previous database, and get a new one
507502
session.removeAttribute("visitor");
508503
session.removeAttribute("visit");

0 commit comments

Comments
 (0)