diff --git a/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod b/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod index 783f5d89e0c..97798a3cfcc 100644 --- a/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod +++ b/jetty-spdy/spdy-http-server/src/main/config/modules/npn.mod @@ -3,13 +3,35 @@ # [files] -http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +${switch java.version +1.7.0_9: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +1.7.0_10: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +1.7.0_11: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.3.v20130313/npn-boot-1.1.3.v20130313.jar:lib/npn/npn-boot-1.1.3.v20130313.jar +1.7.0_13: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.4.v20130313/npn-boot-1.1.4.v20130313.jar:lib/npn/npn-boot-1.1.4.v20130313.jar +1.7.0_15: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +1.7.0_17: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +1.7.0_21: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +1.7.0_25: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.5.v20130313/npn-boot-1.1.5.v20130313.jar:lib/npn/npn-boot-1.1.5.v20130313.jar +1.7.0_40: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +1.7.0_45: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +*: http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.6.v20130911/npn-boot-1.1.6.v20130911.jar:lib/npn/npn-boot-1.1.6.v20130911.jar +} [ini-template] -# NPN Configuration -# NPN boot jar for JRE 1.7.0_45 --exec --Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar +${switch java.version +1.7.0_9: -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar +1.7.0_10: -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar +1.7.0_11: -Xbootclasspath/p:lib/npn/npn-boot-1.1.3.v20130313.jar +1.7.0_13: -Xbootclasspath/p:lib/npn/npn-boot-1.1.4.v20130313.jar +1.7.0_15: -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar +1.7.0_17: -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar +1.7.0_21: -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar +1.7.0_25: -Xbootclasspath/p:lib/npn/npn-boot-1.1.5.v20130313.jar +1.7.0_40: -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar +1.7.0_45: -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar +*: -Xbootclasspath/p:lib/npn/npn-boot-1.1.6.v20130911.jar +} # For other versions of JRE, an appropriate npn-boot jar must be downloaded # 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 0fcf25a1228..a894d33ec1c 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 @@ -661,6 +661,24 @@ public class Main moduleIni(args,module,true,false); } + // Check files + for (FileArg arg : args.getFiles()) + { + File file = baseHome.getBaseFile(arg.location); + if (!file.exists() && args.isDownload()) + initFile(arg); + + if (!file.exists()) + { + args.setRun(false); + String type=arg.location.endsWith("/")?"directory":"file"; + if (arg.uri==null) + StartLog.warn("Required %s '%s' does not exist. Run with --create",type,baseHome.toShortForm(file)); + else + StartLog.warn("Required %s '%s' not downloaded from %s. Run with --download",type,baseHome.toShortForm(file),arg.uri); + } + } + // Informational command line, don't run jetty if (!args.isRun()) { diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java index fdb1416f180..2590c453f68 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Module.java @@ -260,9 +260,37 @@ public class Module { String line; String sectionType = ""; + String caseTag = null; + boolean switched = false; while ((line = buf.readLine()) != null) { line = line.trim(); + + if (caseTag!=null) + { + if ("}".equals(line)) + { + caseTag=null; + continue; + } + + if (switched) + continue; + + if (!line.startsWith(caseTag) && !line.startsWith("*:")) + continue; + + switched=true; + line=line.substring(line.indexOf(':')+1).trim(); + } + else if (line.startsWith("${switch ")) + { + switched=false; + caseTag=line.substring(9).trim(); + caseTag=System.getProperty(caseTag)+":"; + continue; + } + Matcher sectionMatcher = section.matcher(line); if (sectionMatcher.matches()) diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java index 8157e33e5f1..5b02805dab1 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java @@ -85,6 +85,7 @@ public class StartArgs private Modules allModules; // Should the server be run? private boolean run = true; + private boolean download = false; private boolean help = false; private boolean stopCommand = false; private boolean listModules = false; @@ -533,7 +534,12 @@ public class StartArgs } return false; } - + + public boolean isDownload() + { + return download; + } + public boolean isDryRun() { return dryRun; @@ -564,6 +570,11 @@ public class StartArgs return listModules; } + public void setRun(boolean run) + { + this.run = run; + } + public boolean isRun() { return run; @@ -647,6 +658,15 @@ public class StartArgs if (arg.startsWith("--download=")) { addFile(getValue(arg)); + run=false; + download=true; + return; + } + + if (arg.equals("--download") || arg.equals("--create")) + { + run=false; + download=true; return; } @@ -864,4 +884,5 @@ public class StartArgs builder.append("]"); return builder.toString(); } + } diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt index d19a150a6b3..69821e5b496 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt @@ -93,6 +93,12 @@ Module Management: exists for the active ${jetty.base}. See http://graphviz.org/ for details on how to post-process this file into the output best suited for your needs. + + --download Download or create any missing files/directories that are + required by initialised modules. + + --create Download or create any missing files/directories that are + required by initialised modules. Startup / Shutdown Command Line: