diff --git a/VERSION.txt b/VERSION.txt index 7343fd40850..f80c433fb58 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,14 +6,15 @@ jetty-7.3.0-SNAPSHOT + 332432 Scanner.java now always scanning the canonical form of File + 332517 Improved DefaultServlet debug + 332703 Cleanup context scope JNDI at stop - + 332796 Annotations inheritance does not work with jetty7 + + 332796 Annotations inheritance does not work with jetty7 + 332799 100% CPU on redeploy session invalidation + 332937 Added Destroyable interface and reworked dependent lifecycles, specially of JNDI + 333247 fix api compat issue in ConstraintSecurityHandler + 333415 wired up HttpInput.available and added test harnesses + 333481 Handle UTF-32 codepoints + 333608 tlds defined in web.xml are not picked up - + 333679 Refactored jetty-jmx. Moved mbeans to modules. + + 333679 Refactored jetty-jmx. Moved mbeans to modules + + 333771 System properties are not available inside XML configuration file by using the 'property' tag + 333875 Monitor public constructor jetty-7.2.2.v20101205 5 December 2010 diff --git a/jetty-distribution/src/main/resources/bin/jetty.sh b/jetty-distribution/src/main/resources/bin/jetty.sh index c0b1be6a7df..153233232be 100755 --- a/jetty-distribution/src/main/resources/bin/jetty.sh +++ b/jetty-distribution/src/main/resources/bin/jetty.sh @@ -50,7 +50,7 @@ # and /opt/jetty. The java system property "jetty.home" will be # set to this value for use by configure.xml files, f.e.: # -# /webapps/jetty.war +# /webapps/jetty.war # # JETTY_PORT # Override the default port for Jetty servers. If not set then the @@ -60,7 +60,7 @@ # used in the demo config files to respect this property in Listener # configuration elements: # -# +# # # Note: that the config file could ignore this property simply by saying: # diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Config.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Config.java index 991e4f7632e..14cc20d5410 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Config.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Config.java @@ -35,6 +35,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -334,7 +335,7 @@ public class Config if (i2 < 0) break; String name = s.substring(i1 + 2,i2); - String property = getSystemProperty(name); + String property = getProperty(name); s = s.substring(0,i1) + property + s.substring(i2 + 1); } @@ -418,24 +419,39 @@ public class Config public static Properties getProperties() { Properties properties = new Properties(); - for (String key : __properties.keySet()) + // Add System Properties First + Enumeration ensysprop = System.getProperties().propertyNames(); + while(ensysprop.hasMoreElements()) { + String name = (String)ensysprop.nextElement(); + properties.put(name, System.getProperty(name)); + } + // Add Config Properties Next (overwriting any System Properties that exist) + for (String key : __properties.keySet()) { properties.put(key,__properties.get(key)); + } return properties; } public static String getProperty(String name) { - if ("version".equalsIgnoreCase(name)) + if ("version".equalsIgnoreCase(name)) { return _version; - - return __properties.get(name); + } + // Search Config Properties First + if (__properties.containsKey(name)) { + return __properties.get(name); + } + // Return what exists in System.Properties otherwise. + return System.getProperty(name); } - public static String getProperty(String name, String dftValue) + public static String getProperty(String name, String defaultValue) { + // Search Config Properties First if (__properties.containsKey(name)) return __properties.get(name); - return dftValue; + // Return what exists in System.Properties otherwise. + return System.getProperty(name, defaultValue); } /** @@ -461,15 +477,6 @@ public class Config return ids; } - private String getSystemProperty(String name) - { - if ("version".equalsIgnoreCase(name)) - return _version; - if (__properties.containsKey(name)) - return __properties.get(name); - return System.getProperty(name); - } - public List getXmlConfigs() { return _xml; diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java index 9e7dfdc59a9..75fd86e5302 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java @@ -131,8 +131,8 @@ public class Main if ("--stop".equals(arg)) { - int port = Integer.parseInt(_config.getProperty("STOP.PORT",System.getProperty("STOP.PORT","-1"))); - String key = _config.getProperty("STOP.KEY",System.getProperty("STOP.KEY",null)); + int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1")); + String key = Config.getProperty("STOP.KEY",null); stop(port,key); return; } @@ -498,8 +498,8 @@ public class Main public void start(List xmls) throws FileNotFoundException, IOException, InterruptedException { // Setup Start / Stop Monitoring - int port = Integer.parseInt(_config.getProperty("STOP.PORT",System.getProperty("STOP.PORT","-1"))); - String key = _config.getProperty("STOP.KEY",System.getProperty("STOP.KEY",null)); + int port = Integer.parseInt(Config.getProperty("STOP.PORT","-1")); + String key = Config.getProperty("STOP.KEY",null); Monitor monitor=new Monitor(port,key); @@ -536,7 +536,7 @@ public class Main System.err.println("java.class.path=" + classpath); System.err.println("classloader=" + cl); System.err.println("classloader.parent=" + cl.getParent()); - System.err.println("properties="+_config.getProperties()); + System.err.println("properties=" + Config.getProperties()); } // Show the usage information and return @@ -1017,7 +1017,7 @@ public class Main // parse the config _config.parse(cfgstream); - _jettyHome = _config.getProperty("jetty.home"); + _jettyHome = Config.getProperty("jetty.home"); if (_jettyHome != null) { _jettyHome = new File(_jettyHome).getCanonicalPath(); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigTest.java index 58a59df3a92..bc61e729b3e 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ConfigTest.java @@ -113,7 +113,7 @@ public class ConfigTest Config cfg = new Config(); cfg.parse(buf); - Assert.assertEquals(getTestResourcesDir().getCanonicalPath(),cfg.getProperty("test.resources.dir")); + Assert.assertEquals(getTestResourcesDir().getCanonicalPath(),Config.getProperty("test.resources.dir")); } /* @@ -129,8 +129,8 @@ public class ConfigTest Config options = new Config(); options.parse(buf); - Assert.assertEquals("foo",options.getProperty("test.jetty.start.text")); - Assert.assertEquals("Eatagramovabits",options.getProperty("test.jetty.start.quote")); + Assert.assertEquals("foo",Config.getProperty("test.jetty.start.text")); + Assert.assertEquals("Eatagramovabits",Config.getProperty("test.jetty.start.quote")); } /* diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index f678a5a330e..eb68474004e 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -28,13 +28,12 @@ import java.net.UnknownHostException; import java.security.AccessControlException; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -174,7 +173,7 @@ public class XmlConfiguration /* ------------------------------------------------------------ */ /** - * @deprecated use {@link #getProperties()}.put(...) + * @deprecated use {@link #getProperties()}.putAll(...) */ public void setProperties (Map map) { @@ -1021,8 +1020,15 @@ public class XmlConfiguration } // If no start.config properties, use clean slate - if (properties==null) + if (properties==null) { properties = new Properties(); + // Add System Properties + Enumeration ensysprop = System.getProperties().propertyNames(); + while(ensysprop.hasMoreElements()) { + String name = (String)ensysprop.nextElement(); + properties.put(name, System.getProperty(name)); + } + } // For all arguments, load properties or parse XMLs XmlConfiguration last = null; @@ -1042,8 +1048,9 @@ public class XmlConfiguration if ( properties.size() > 0 ) { Map props = new HashMap(); - for (Object key:properties.keySet()) + for (Object key:properties.keySet()) { props.put(key.toString(),String.valueOf(properties.get(key))); + } configuration.setProperties( props ); } obj[i] = configuration.configure();