Allow getdown applets to specify an app_properties param which contains a comma
separated list of system properties specified as <key>=<value> to set on the launched application.
This commit is contained in:
@@ -157,7 +157,7 @@ public class Application
|
||||
*/
|
||||
public Application (File appdir, String appid)
|
||||
{
|
||||
this(appdir, appid, null);
|
||||
this(appdir, appid, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,13 +169,17 @@ public class Application
|
||||
* <code>appid.apparg</code> to configure itself but all other parameters will be the same as
|
||||
* the primary application.
|
||||
* @param signers an array of possible signers of this application. Used to verify the digest.
|
||||
* @param jvmargs arguments to pass on to launched jvms
|
||||
*/
|
||||
public Application (File appdir, String appid, Object[] signers)
|
||||
public Application (File appdir, String appid, Object[] signers, String[] jvmargs)
|
||||
{
|
||||
_appdir = appdir;
|
||||
_appid = appid;
|
||||
_signers = signers;
|
||||
_config = getLocalPath(CONFIG_FILE);
|
||||
if (jvmargs != null) {
|
||||
_baseJvmArgs = jvmargs;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -537,6 +541,11 @@ public class Application
|
||||
_jvmargs.add(jvmargs[ii]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the launch specific JVM arguments
|
||||
for (String arg : _baseJvmArgs) {
|
||||
_jvmargs.add(arg);
|
||||
}
|
||||
|
||||
// transfer our application arguments
|
||||
String[] appargs = ConfigUtil.getMultiValue(cdata, prefix + "apparg");
|
||||
@@ -1315,6 +1324,8 @@ public class Application
|
||||
|
||||
protected ArrayList<String> _jvmargs = new ArrayList<String>();
|
||||
protected ArrayList<String> _appargs = new ArrayList<String>();
|
||||
|
||||
protected String[] _baseJvmArgs = new String[0];
|
||||
|
||||
protected Object[] _signers;
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@ public abstract class Getdown extends Thread
|
||||
|
||||
public Getdown (File appDir, String appId)
|
||||
{
|
||||
this(appDir, appId, null);
|
||||
this(appDir, appId, null, null);
|
||||
}
|
||||
|
||||
public Getdown (File appDir, String appId, Object[] signers)
|
||||
public Getdown (File appDir, String appId, Object[] signers, String[] jvmargs)
|
||||
{
|
||||
super("Getdown");
|
||||
try {
|
||||
@@ -116,7 +116,7 @@ public abstract class Getdown extends Thread
|
||||
"\nis invalid. The directory must not contain the '!' character. Please reinstall.";
|
||||
fail(errmsg);
|
||||
}
|
||||
_app = new Application(appDir, appId, signers);
|
||||
_app = new Application(appDir, appId, signers, jvmargs);
|
||||
_startup = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@ import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.swing.JApplet;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.samskivert.util.RunAnywhere;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
|
||||
/**
|
||||
@@ -91,11 +91,23 @@ public class GetdownApplet extends JApplet
|
||||
_errmsg = e.getMessage();
|
||||
}
|
||||
|
||||
// Pull out system properties to pass through to the launched vm if they exist
|
||||
String params = getParameter("app_properties");
|
||||
String[] jvmargs;
|
||||
if(params == null){
|
||||
jvmargs = new String[0];
|
||||
} else {
|
||||
jvmargs = params.split(",");
|
||||
for (int ii = 0; ii < jvmargs.length; ii++) {
|
||||
jvmargs[ii] = "-D" + jvmargs[ii];
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// XXX getSigners() returns all certificates used to sign this applet which may allow
|
||||
// a third party to insert a trusted certificate. This should be replaced with
|
||||
// statically included trusted keys.
|
||||
_getdown = new Getdown(appdir, null, GetdownApplet.class.getSigners()) {
|
||||
_getdown = new Getdown(appdir, null, GetdownApplet.class.getSigners(), jvmargs) {
|
||||
protected Container createContainer () {
|
||||
getContentPane().removeAll();
|
||||
return getContentPane();
|
||||
|
||||
Reference in New Issue
Block a user