6156bfc8 by Adam Heath

Pass the mapped service-model into the checkSession service.

Refs: #7922
1 parent 33225dc9
......@@ -396,6 +396,14 @@ public class DirectControlServlet extends HttpServlet {
Delegator delegator = getDelegator(request.getServletContext());
LocalDispatcher dispatcher = getDispatcher(request.getServletContext());
DispatchContext dctx = dispatcher.getDispatchContext();
ModelService model = dctx.getModelService(serviceName);
// some needed info for when running the service
Locale locale = UtilHttp.getLocale(request);
TimeZone timeZone = UtilHttp.getTimeZone(request);
List<Object> errorMessages = new ArrayList<Object>();
// Check if there is an output handler
......@@ -427,7 +435,13 @@ public class DirectControlServlet extends HttpServlet {
// prolong the session
if (UtilValidate.isNotEmpty(checkSessionService)) {
dispatcher.runSync(checkSessionService, UtilMisc.<String, Object>toMap("sessionId", authToken, "userLogin", userLogin));
Map<String, Object> checkSessionServiceContext = new HashMap<String, Object>();
checkSessionServiceContext.put("sessionId", authToken);
checkSessionServiceContext.put("userLogin", userLogin);
checkSessionServiceContext.put("serviceModel", model);
ModelService checkSessionModel = dctx.getModelService(checkSessionService);
checkSessionServiceContext = checkSessionModel.makeValid(checkSessionServiceContext, ModelService.IN_PARAM, true, errorMessages, timeZone, locale);
dispatcher.runSync(checkSessionService, checkSessionServiceContext);
}
}
}
......@@ -439,15 +453,6 @@ public class DirectControlServlet extends HttpServlet {
context.put("httpProtocol", request.getProtocol());
context.put("httpScheme", request.getScheme());
DispatchContext dctx = dispatcher.getDispatchContext();
ModelService model = dctx.getModelService(serviceName);
// some needed info for when running the service
Locale locale = UtilHttp.getLocale(request);
TimeZone timeZone = UtilHttp.getTimeZone(request);
List<Object> errorMessages = new ArrayList<Object>();
context = model.makeValid(context, ModelService.IN_PARAM, true, errorMessages, timeZone, locale);
Map<String, Object> result = dispatcher.runSync(serviceName, context);
......