249f5ebb by Ean Schuessler

Merge branch 'BF-7922' of /home/git/repositories/brainfood/ofbiz-directcontrolservlet

2 parents 33225dc9 6156bfc8
...@@ -396,6 +396,14 @@ public class DirectControlServlet extends HttpServlet { ...@@ -396,6 +396,14 @@ public class DirectControlServlet extends HttpServlet {
396 396
397 Delegator delegator = getDelegator(request.getServletContext()); 397 Delegator delegator = getDelegator(request.getServletContext());
398 LocalDispatcher dispatcher = getDispatcher(request.getServletContext()); 398 LocalDispatcher dispatcher = getDispatcher(request.getServletContext());
399 DispatchContext dctx = dispatcher.getDispatchContext();
400 ModelService model = dctx.getModelService(serviceName);
401
402 // some needed info for when running the service
403 Locale locale = UtilHttp.getLocale(request);
404 TimeZone timeZone = UtilHttp.getTimeZone(request);
405
406 List<Object> errorMessages = new ArrayList<Object>();
399 407
400 // Check if there is an output handler 408 // Check if there is an output handler
401 409
...@@ -427,7 +435,13 @@ public class DirectControlServlet extends HttpServlet { ...@@ -427,7 +435,13 @@ public class DirectControlServlet extends HttpServlet {
427 435
428 // prolong the session 436 // prolong the session
429 if (UtilValidate.isNotEmpty(checkSessionService)) { 437 if (UtilValidate.isNotEmpty(checkSessionService)) {
430 dispatcher.runSync(checkSessionService, UtilMisc.<String, Object>toMap("sessionId", authToken, "userLogin", userLogin)); 438 Map<String, Object> checkSessionServiceContext = new HashMap<String, Object>();
439 checkSessionServiceContext.put("sessionId", authToken);
440 checkSessionServiceContext.put("userLogin", userLogin);
441 checkSessionServiceContext.put("serviceModel", model);
442 ModelService checkSessionModel = dctx.getModelService(checkSessionService);
443 checkSessionServiceContext = checkSessionModel.makeValid(checkSessionServiceContext, ModelService.IN_PARAM, true, errorMessages, timeZone, locale);
444 dispatcher.runSync(checkSessionService, checkSessionServiceContext);
431 } 445 }
432 } 446 }
433 } 447 }
...@@ -439,15 +453,6 @@ public class DirectControlServlet extends HttpServlet { ...@@ -439,15 +453,6 @@ public class DirectControlServlet extends HttpServlet {
439 context.put("httpProtocol", request.getProtocol()); 453 context.put("httpProtocol", request.getProtocol());
440 context.put("httpScheme", request.getScheme()); 454 context.put("httpScheme", request.getScheme());
441 455
442 DispatchContext dctx = dispatcher.getDispatchContext();
443 ModelService model = dctx.getModelService(serviceName);
444
445 // some needed info for when running the service
446 Locale locale = UtilHttp.getLocale(request);
447 TimeZone timeZone = UtilHttp.getTimeZone(request);
448
449 List<Object> errorMessages = new ArrayList<Object>();
450
451 context = model.makeValid(context, ModelService.IN_PARAM, true, errorMessages, timeZone, locale); 456 context = model.makeValid(context, ModelService.IN_PARAM, true, errorMessages, timeZone, locale);
452 457
453 Map<String, Object> result = dispatcher.runSync(serviceName, context); 458 Map<String, Object> result = dispatcher.runSync(serviceName, context);
......