Index: lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java,v diff -u -r1.10 -r1.11 --- lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java 14 Oct 2005 04:30:34 -0000 1.10 +++ lams_common/src/java/org/lamsfoundation/lams/util/WebUtil.java 24 Oct 2005 05:41:12 -0000 1.11 @@ -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