You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/02/09 01:29:54 UTC
svn commit: r907856 -
/pivot/trunk/wtk/src/org/apache/pivot/wtk/BrowserApplicationContext.java
Author: gbrown
Date: Tue Feb 9 00:29:54 2010
New Revision: 907856
URL: http://svn.apache.org/viewvc?rev=907856&view=rev
Log:
Add system_properties parameter to BrowserApplicationContext (intrinsic java_arguments parameter does not support application-defined properties).
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/BrowserApplicationContext.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/BrowserApplicationContext.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/BrowserApplicationContext.java?rev=907856&r1=907855&r2=907856&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/BrowserApplicationContext.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/BrowserApplicationContext.java Tue Feb 9 00:29:54 2010
@@ -71,12 +71,37 @@
}
}
+ // Load properties specified in the system properties parameter
+ String systemPropertiesParameter = getParameter(SYSTEM_PROPERTIES_PARAMETER);
+ if (systemPropertiesParameter != null) {
+ String[] arguments = systemPropertiesParameter.split("&");
+
+ for (int i = 0, n = arguments.length; i < n; i++) {
+ String argument = arguments[i];
+ String[] property = argument.split("=");
+
+ if (property.length == 2) {
+ String key = property[0].trim();
+ String value;
+ try {
+ value = URLDecoder.decode(property[1].trim(), "UTF-8");
+ } catch (UnsupportedEncodingException exception) {
+ throw new RuntimeException(exception);
+ }
+
+ System.setProperty(key, value);
+ } else {
+ System.err.println(argument + " is not a valid system property.");
+ }
+ }
+ }
+
// Load properties specified in the startup properties parameter
- properties = new HashMap<String, String>();
+ startupProperties = new HashMap<String, String>();
- String startupProperties = getParameter(STARTUP_PROPERTIES_PARAMETER);
- if (startupProperties != null) {
- String[] arguments = startupProperties.split("&");
+ String startupPropertiesParameter = getParameter(STARTUP_PROPERTIES_PARAMETER);
+ if (startupPropertiesParameter != null) {
+ String[] arguments = startupPropertiesParameter.split("&");
for (int i = 0, n = arguments.length; i < n; i++) {
String argument = arguments[i];
@@ -90,7 +115,7 @@
} catch (UnsupportedEncodingException exception) {
throw new RuntimeException(exception);
}
- properties.put(key, value);
+ startupProperties.put(key, value);
} else {
System.err.println(argument + " is not a valid startup property.");
}
@@ -148,7 +173,7 @@
if (application != null) {
try {
application.startup(applicationContext.getDisplay(),
- new ImmutableMap<String, String>(properties));
+ new ImmutableMap<String, String>(startupProperties));
} catch (Exception exception) {
displayException(exception);
}
@@ -192,10 +217,11 @@
}
private transient BrowserApplicationContext applicationContext = null;
- private HashMap<String, String> properties = null;
+ private HashMap<String, String> startupProperties = null;
public static final String APPLICATION_CLASS_NAME_PARAMETER = "application_class_name";
public static final String STARTUP_PROPERTIES_PARAMETER = "startup_properties";
+ public static final String SYSTEM_PROPERTIES_PARAMETER = "system_properties";
public Application getApplication() {
return applicationContext.getApplication();