diff --git a/applications/accounting/webapp/accounting/WEB-INF/controller.xml b/applications/accounting/webapp/accounting/WEB-INF/controller.xml index 87ae266b0a2..04c1ded1d42 100644 --- a/applications/accounting/webapp/accounting/WEB-INF/controller.xml +++ b/applications/accounting/webapp/accounting/WEB-INF/controller.xml @@ -42,12 +42,6 @@ under the License. - - - - - - diff --git a/applications/content/webapp/content/WEB-INF/controller.xml b/applications/content/webapp/content/WEB-INF/controller.xml index 9c9501082cb..25e644a99c2 100644 --- a/applications/content/webapp/content/WEB-INF/controller.xml +++ b/applications/content/webapp/content/WEB-INF/controller.xml @@ -52,13 +52,6 @@ under the License. - - - - - - - diff --git a/applications/humanres/webapp/humanres/WEB-INF/controller.xml b/applications/humanres/webapp/humanres/WEB-INF/controller.xml index 782c7c599bf..39262882409 100644 --- a/applications/humanres/webapp/humanres/WEB-INF/controller.xml +++ b/applications/humanres/webapp/humanres/WEB-INF/controller.xml @@ -46,12 +46,6 @@ under the License. - - - - - - diff --git a/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml b/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml index f4f084b648d..8d3eeb0cf4a 100644 --- a/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml +++ b/applications/manufacturing/webapp/manufacturing/WEB-INF/controller.xml @@ -46,12 +46,6 @@ under the License. - - - - - - diff --git a/applications/marketing/webapp/marketing/WEB-INF/controller.xml b/applications/marketing/webapp/marketing/WEB-INF/controller.xml index 81a8c3c87b3..2dd5d459563 100644 --- a/applications/marketing/webapp/marketing/WEB-INF/controller.xml +++ b/applications/marketing/webapp/marketing/WEB-INF/controller.xml @@ -45,13 +45,6 @@ under the License. - - - - - - - diff --git a/applications/product/webapp/catalog/WEB-INF/controller.xml b/applications/product/webapp/catalog/WEB-INF/controller.xml index 21980cf8d67..a972b6a6eea 100644 --- a/applications/product/webapp/catalog/WEB-INF/controller.xml +++ b/applications/product/webapp/catalog/WEB-INF/controller.xml @@ -63,13 +63,6 @@ under the License. - - - - - - - diff --git a/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml b/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml index ee3fd54b835..e9aba556df3 100644 --- a/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml +++ b/applications/workeffort/webapp/workeffort/WEB-INF/controller.xml @@ -39,12 +39,6 @@ under the License. - - - - - - diff --git a/framework/bi/webapp/bi/WEB-INF/controller.xml b/framework/bi/webapp/bi/WEB-INF/controller.xml index a554b7bbe10..546b27b8691 100644 --- a/framework/bi/webapp/bi/WEB-INF/controller.xml +++ b/framework/bi/webapp/bi/WEB-INF/controller.xml @@ -30,12 +30,6 @@ - - - - - - diff --git a/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java b/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java index f19fdaa4ec9..9ec8bfdf504 100644 --- a/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java +++ b/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java @@ -317,10 +317,10 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha LocalDispatcher dispatcher = getDispatcher(config.getServletContext()); // set web context objects - httpRequest.getSession().setAttribute("dispatcher", dispatcher); - httpRequest.getSession().setAttribute("security", security); + request.setAttribute("dispatcher", dispatcher); + request.setAttribute("security", security); - httpRequest.setAttribute("tenantId", tenantId); + request.setAttribute("tenantId", tenantId); } // NOTE DEJ20101130: do NOT always put the delegator name in the user's session because the user may diff --git a/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java b/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java index 7cc4322b4b3..e0737063d34 100644 --- a/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java +++ b/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java @@ -474,35 +474,30 @@ public static String login(HttpServletRequest request, HttpServletResponse respo return "error"; } } + private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) { HttpSession session = request.getSession(); - - // NOTE: we do NOT want to set this in the servletContet, only in the request and session - session.setAttribute("delegatorName", delegator.getDelegatorName()); - - request.setAttribute("delegator", delegator); - session.setAttribute("delegator", delegator); - - request.setAttribute("dispatcher", dispatcher); - session.setAttribute("dispatcher", dispatcher); - - // we also need to setup the security and authz objects since they are dependent on the delegator + // NOTE: we do NOT want to set this in the servletContext, only in the request and session + // We also need to setup the security and authz objects since they are dependent on the delegator + Security security = null; try { - Security security = SecurityFactory.getInstance(delegator); - request.setAttribute("security", security); - session.setAttribute("security", security); + security = SecurityFactory.getInstance(delegator); } catch (SecurityConfigurationException e) { Debug.logError(e, module); } - + Authorization authz = null; try { - Authorization authz = AuthorizationFactory.getInstance(delegator); - request.setAttribute("authz", authz); - session.setAttribute("authz", authz); + authz = AuthorizationFactory.getInstance(delegator); } catch (SecurityConfigurationException e) { Debug.logError(e, module); } + session.setAttribute("delegatorName", delegator.getDelegatorName()); + request.setAttribute("delegator", delegator); + request.setAttribute("dispatcher", dispatcher); + request.setAttribute("security", security); + request.setAttribute("authz", authz); + // get rid of the visit info since it was pointing to the previous database, and get a new one session.removeAttribute("visitor"); session.removeAttribute("visit"); diff --git a/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java b/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java index e122a885049..de508929d96 100644 --- a/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java +++ b/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java @@ -96,96 +96,6 @@ public static String returnNull(HttpServletRequest request, HttpServletResponse return null; } - /** - * Change delegator event. Changes the delegator for the current session - * @param request HttpServletRequest - * @param response HttpServletResponse - * @return Response code string - */ - public static String changeDelegator(HttpServletRequest request, HttpServletResponse response) { - String delegatorName = request.getParameter("delegator"); - Authorization authz = (Authorization) request.getAttribute("authz"); - Locale locale = UtilHttp.getLocale(request); - - if (!authz.hasPermission(request.getSession(), "ENTITY_MAINT", null)) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_use_fct", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); - return "error"; - } - if (delegatorName == null) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.delegator_not_passed", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); - return "error"; - } - - Delegator delegator = DelegatorFactory.getDelegator(delegatorName); - - if (delegator == null) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.no_delegator_name_defined", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); - return "error"; - } - - // now change the dispatcher to use this delegator - LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - DispatchContext dctx = dispatcher.getDispatchContext(); - String dispatcherName = dispatcher.getName(); - - if (dispatcherName == null) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.dispatcher_name_null", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); - return "error"; - } - if (dctx == null) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.dispatcher_context_null", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); - return "error"; - } - - dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator); - - request.getSession().setAttribute("delegator", delegator); - request.getSession().setAttribute("dispatcher", dispatcher); - - return "success"; - } - - /** - * Change dispatcher event. Changes the dispatch for the current session - * @param request HttpServletRequest - * @param response HttpServletResponse - * @return Response code string - */ - public static String changeDispatcher(HttpServletRequest request, HttpServletResponse response) { - String dispatcherName = request.getParameter("dispatcher"); - Authorization authz = (Authorization) request.getAttribute("authz"); - Locale locale = UtilHttp.getLocale(request); - - if (!authz.hasPermission(request.getSession(), "ENTITY_MAINT", null)) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_use_fct", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); - return "error"; - } - if (dispatcherName == null) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.dispatcher_not_passed", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); - return "error"; - } - - Delegator delegator = (Delegator) request.getAttribute("delegator"); - ServiceDispatcher sd = ServiceDispatcher.getInstance(dispatcherName, delegator); - - if (sd == null) { - String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.no_dispachter_name_registered", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); - return "error"; - } - LocalDispatcher dispatcher = sd.getLocalContext(dispatcherName).getDispatcher(); - - request.getSession().setAttribute("dispatcher", dispatcher); - return "success"; - } - /** * Schedule a service for a specific time or recurrence * Request Parameters which are used for this service: diff --git a/framework/webtools/webapp/webtools/WEB-INF/controller.xml b/framework/webtools/webapp/webtools/WEB-INF/controller.xml index 308806c2719..819a56e8384 100644 --- a/framework/webtools/webapp/webtools/WEB-INF/controller.xml +++ b/framework/webtools/webapp/webtools/WEB-INF/controller.xml @@ -92,12 +92,6 @@ under the License. - - - - - - diff --git a/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml b/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml index dc55f087a06..af7edf184e8 100644 --- a/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml +++ b/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml @@ -1193,13 +1193,6 @@ under the License. - - - - - - -