You can now override the scheme and domain of the appbase and latest URLs specified in your
getdown.txt by setting the appbase_domain system property when launching getdown as an application
This commit is contained in:
@@ -501,6 +501,9 @@ public class Application
|
||||
_appbase = _appbase + "/";
|
||||
}
|
||||
|
||||
// check if we're overriding the domain in the appbase
|
||||
_appbase = replaceDomain(_appbase);
|
||||
|
||||
// extract our version information
|
||||
String vstr = (String)cdata.get("version");
|
||||
if (vstr != null) {
|
||||
@@ -527,6 +530,7 @@ public class Application
|
||||
// check for a latest config URL
|
||||
String latest = (String)cdata.get("latest");
|
||||
if (latest != null) {
|
||||
latest = replaceDomain(latest);
|
||||
try {
|
||||
_latest = new URL(latest);
|
||||
} catch (MalformedURLException mue) {
|
||||
@@ -1620,6 +1624,19 @@ public class Application
|
||||
return cookie.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* If appbase_domain property is set, replace the domain on the provided string.
|
||||
*/
|
||||
protected String replaceDomain (String appbase)
|
||||
{
|
||||
String appbaseDomain = System.getProperty("appbase_domain");
|
||||
if (appbaseDomain != null) {
|
||||
Matcher m = Pattern.compile("(http://[^/]+)(.*)").matcher(appbase);
|
||||
appbase = m.replaceAll(appbaseDomain + "$2");
|
||||
}
|
||||
return appbase;
|
||||
}
|
||||
|
||||
protected File _appdir;
|
||||
protected String _appid;
|
||||
protected File _config;
|
||||
|
||||
Reference in New Issue
Block a user