Index: lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java =================================================================== diff -u -r87100d8d1814fe188e4bbc198a9be03f52fb0f1c -r48ad0d8484c393361953c6a45b5135f3a63173ba --- lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java (.../WebUtil.java) (revision 87100d8d1814fe188e4bbc198a9be03f52fb0f1c) +++ lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java (.../WebUtil.java) (revision 48ad0d8484c393361953c6a45b5135f3a63173ba) @@ -398,5 +398,28 @@ return url+"&"; } + /** Converts a url (such as one from a tool) to a complete url. + * If the url starts with "http" then it is assumed to be a complete url + * and is returned as is. + * Otherwise it assumes starts with the path of the webapp so it is + * appended to the server url from the LAMS Configuration. + * @param url e.g. tool/lanb11/starter/learner.do + * @return complete url + */ + public static String convertToFullURL(String url) { + if ( url == null ) + return null; + else if ( url.startsWith("http") ) + return url; + else { + String serverURL = Configuration.get(ConfigurationKeys.SERVER_URL); + if ( url.charAt(0) == '/' ) + return serverURL + url; + else + return serverURL + '/' + url; + } + } + + } \ No newline at end of file