in platforms/osgi-war/src/main/java/io/hawt/blueprint/HawtioBlueprintContextListener.java [102:128]
protected void appendEnvironmentVariablesAndSystemProperties(ServletContext servletContext, Map<String, String> properties) {
try {
Properties sysProperties = System.getProperties();
// iterating over sysProps.keySet() directly is not thread-safe and may throw ConcurrentMod.Ex.,
// so first get the keys and then query their values
Set<String> keys = sysProperties.stringPropertyNames();
for (String propertyName : keys) {
String propertyValue = sysProperties.getProperty(propertyName); // value can be null if removed in meantime, but unlikely
if (propertyName != null && propertyValue != null &&
!properties.containsKey(propertyName)) {
properties.put(propertyName, propertyValue);
}
}
Map<String, String> env = System.getenv();
if (env != null) {
Set<Map.Entry<String, String>> entries = env.entrySet();
for (Map.Entry<String, String> entry : entries) {
String name = entry.getKey();
String propertyName = convertEnvironmentVariableToSystemProperty(name);
properties.put(propertyName, entry.getValue());
}
}
} catch (Exception e) {
servletContext.log("Failed to load environment variables: " + e, e);
}
}