map.addAttribute("appDefinition", appDef);
map.addAttribute("appVersion", appDef.getVersion());
map.addAttribute("key", key);
map.addAttribute("menuId", menuId);
map.addAttribute("embed", embed);
UserviewDefinition userview = userviewDefinitionDao.loadById(userviewId, appDef);
if (userview != null) {
String json = userview.getJson();
map.addAttribute("userview", userviewService.createUserview(json, null, false, request.getContextPath(), request.getParameterMap(), key, embed));
}
return "ubuilder/login";
} else if (savedUrl.contains("/web/mlogin") || savedUrl.contains("/web/embed/mlogin")) {
Boolean embed = false;
if (savedUrl.equals("/web/mlogin") || savedUrl.equals("/web/embed/mlogin")) {
savedUrl = "";
} else if (savedUrl.contains("/web/mlogin")) {
savedUrl = savedUrl.substring(savedUrl.indexOf("/web/mlogin"));
savedUrl = savedUrl.replace("/web/mlogin/", "");
} else {
savedUrl = savedUrl.substring(savedUrl.indexOf("/web/embed/mlogin"));
savedUrl = savedUrl.replace("/web/embed/mlogin/", "");
embed = true;
}
if (savedUrl.isEmpty()) {
return "mobile/mLogin";
}
String[] urlKey = savedUrl.split("/");
String appId = urlKey[0];
String userviewId = urlKey[1];
String key = null;
String menuId = null;
if (urlKey.length > 2) {
key = urlKey[2];
if (urlKey.length > 3) {
menuId = urlKey[3];
}
}
Long appVersion = appService.getPublishedVersion(appId);
if (appVersion == null || appVersion == 0) {
return "error404";
}
// retrieve app and userview
AppDefinition appDef = appService.getAppDefinition(appId, appVersion.toString());
if (appDef == null) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return null;
}
map.addAttribute("appId", appId);
map.addAttribute("appDefinition", appDef);
map.addAttribute("appVersion", appDef.getVersion());
map.addAttribute("key", key);
map.addAttribute("menuId", menuId);
map.addAttribute("embed", embed);
UserviewDefinition userview = userviewDefinitionDao.loadById(userviewId, appDef);
if (userview != null) {
String json = userview.getJson();
map.addAttribute("userview", userviewService.createUserview(json, null, false, request.getContextPath(), request.getParameterMap(), key, embed));
}
return "mobile/mLogin";
} else if (savedUrl.contains(request.getContextPath() + "/mobile")) {