/** * Compute the URL that would return to this servlet based on the current request, with the optional path and parameters * * @param req * The request. * @return The URL back to this servlet based on the current request. */ public static String returnUrl(HttpServletRequest req, String path) { StringBuilder url = new StringBuilder(); url.append(serverUrl(req)); url.append(req.getContextPath()); url.append(req.getServletPath()); if (path != null) url.append(path); // TODO: params return url.toString(); }
/** * Send the HTML / Javascript to invoke an automatic update * * @param out * @param req * The request. * @param placementId * The tool's placement id / presence location / part of the delivery address * @param updateTime * The time (seconds) between courier checks * @deprecated * To avoid inappropriate kernel dependencies, construct this URL in the tool pending relocation of this to courier (see SAK-18481). */ public static void sendAutoUpdate(PrintWriter out, HttpServletRequest req, String placementId, int updateTime) { String userId = ComponentManager.get(SessionManager.class).getCurrentSessionUserId(); StringBuilder url = new StringBuilder(serverUrl(req)); url.append("/courier/"); url.append(placementId); url.append("?userId="); url.append(userId); out.println("<script type=\"text/javascript\" language=\"JavaScript\">"); out.println("updateTime = " + updateTime + "000;"); out.println("updateUrl = \"" + url.toString() + "\";"); out.println("scheduleUpdate();"); out.println("</script>"); }
/** * Setup the vm context for a courier * * @param request */ protected void setVmCourier(HttpServletRequest request, int refresh) { // the url for the chat courier Placement placement = ToolManager.getCurrentPlacement(); if (placement != null) { String userId = SessionManager.getCurrentSessionUserId(); StringBuilder url = new StringBuilder(Web.serverUrl(request)); url.append("/courier/"); url.append(placement.getId()); url.append("?userId="); url.append(userId); setVmReference("courier", url.toString(), request); setVmReference("courierTimeout", Integer.toString(refresh), request); } }
/** * Setup the vm context for a courier * * @param request */ protected void setVmCourier(HttpServletRequest request, int refresh) { // the url for the chat courier Placement placement = ToolManager.getCurrentPlacement(); if (placement != null) { String userId = SessionManager.getCurrentSessionUserId(); StringBuilder url = new StringBuilder(Web.serverUrl(request)); url.append("/courier/"); url.append(placement.getId()); url.append("?userId="); url.append(userId); setVmReference("courier", url.toString(), request); setVmReference("courierTimeout", Integer.toString(refresh), request); } }
String siteUrl = Web.serverUrl(req) + ServerConfigurationService.getString("portalPath") + "/"; if (prefix != null) siteUrl = siteUrl + prefix + "/";
String siteUrl = Web.serverUrl(req) + ServerConfigurationService.getString("portalPath") + "/"; if (prefix != null) siteUrl = siteUrl + prefix + "/";
resetActionUrl = Web.serverUrl(req) + ServerConfigurationService.getString("portalPath") + URLUtils.getSafePathInfo(req) + "?sakai.state.reset=true"; toolMap.put("toolJSR168Help", Web.serverUrl(req) + renderResult.getJSR168HelpUrl()); .getReference())) String editUrl = Web.serverUrl(req) + renderResult.getJSR168EditUrl(); toolMap.put("toolJSR168Edit", editUrl); toolMap.put("toolJSR168EditEncode", URLUtils.encodeUrl(editUrl));
resetActionUrl = Web.serverUrl(req) + ServerConfigurationService.getString("portalPath") + URLUtils.getSafePathInfo(req) + "?sakai.state.reset=true"; toolMap.put("toolJSR168Help", Web.serverUrl(req) + renderResult.getJSR168HelpUrl()); .getReference())) String editUrl = Web.serverUrl(req) + renderResult.getJSR168EditUrl(); toolMap.put("toolJSR168Edit", editUrl); toolMap.put("toolJSR168EditEncode", URLUtils.encodeUrl(editUrl));
rcontext.put("currentUrlPath", Web.serverUrl(req) + req.getContextPath() + URLUtils.getSafePathInfo(req));
rcontext.put("currentUrlPath", Web.serverUrl(req) + req.getContextPath() + URLUtils.getSafePathInfo(req));
String logInOutUrl = Web.serverUrl(req); String message = null; String image1 = null;
String logInOutUrl = Web.serverUrl(req); String message = null; String image1 = null;
String portalTopUrl = Web.serverUrl(req) + ServerConfigurationService.getString("portalPath") + "/"; if (prefix != null) portalTopUrl = portalTopUrl + prefix + "/";
String portalTopUrl = Web.serverUrl(req) + ServerConfigurationService.getString("portalPath") + "/"; if (prefix != null) portalTopUrl = portalTopUrl + prefix + "/";