diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-05-26 08:57:16 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2010-05-26 08:57:16 +0000 |
commit | bfaf1b0c4a9a7b40a4115e6e737dcd9ed3b9b374 (patch) | |
tree | 07644a71fe1d9a3d4994f70a3cdc5fdca69443a7 /src/com/vaadin/launcher | |
parent | dd5ee4f3b5ec0f817fffc22b010254af3ee3077c (diff) | |
download | vaadin-framework-bfaf1b0c4a9a7b40a4115e6e737dcd9ed3b9b374.tar.gz vaadin-framework-bfaf1b0c4a9a7b40a4115e6e737dcd9ed3b9b374.zip |
development server now dies properly if address is already in use or another prevented jetty to properly start up
svn changeset:13366/svn branch:6.4
Diffstat (limited to 'src/com/vaadin/launcher')
-rw-r--r-- | src/com/vaadin/launcher/DemoLauncher.java | 4 | ||||
-rw-r--r-- | src/com/vaadin/launcher/DevelopmentServerLauncher.java | 39 |
2 files changed, 23 insertions, 20 deletions
diff --git a/src/com/vaadin/launcher/DemoLauncher.java b/src/com/vaadin/launcher/DemoLauncher.java index d52df1f8ae..38b6060a27 100644 --- a/src/com/vaadin/launcher/DemoLauncher.java +++ b/src/com/vaadin/launcher/DemoLauncher.java @@ -34,7 +34,7 @@ import com.vaadin.launcher.util.BrowserLauncher; */ public class DemoLauncher { - public static void main(String[] args) { + public static void main(String[] args) throws Exception { final Map serverArgs = DevelopmentServerLauncher.parseArguments(args); boolean deployed = false; @@ -59,7 +59,7 @@ public class DemoLauncher { } } - // Start the Winstone servlet container + // Start the Jetty servlet container final String url = DevelopmentServerLauncher.runServer(serverArgs, "Demo Server"); diff --git a/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/src/com/vaadin/launcher/DevelopmentServerLauncher.java index b7caa881b1..79e9775d5e 100644 --- a/src/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/src/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -30,8 +30,9 @@ public class DevelopmentServerLauncher { * for options.
*
* @param args
+ * @throws Exception
*/
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
// Pass-through of arguments for Jetty
final Map<String, String> serverArgs = parseArguments(args);
@@ -55,9 +56,11 @@ public class DevelopmentServerLauncher { *
* @param serverArgs
* @return
+ * @throws Exception
+ * @throws Exception
*/
protected static String runServer(Map<String, String> serverArgs,
- String mode) {
+ String mode) throws Exception {
// Assign default values for some arguments
assignDefault(serverArgs, "webroot", "WebContent");
@@ -81,27 +84,27 @@ public class DevelopmentServerLauncher { + serverPort
+ "\n-------------------------------------------------\n");
- try {
- final Server server = new Server();
+ final Server server = new Server();
- final Connector connector = new SelectChannelConnector();
+ final Connector connector = new SelectChannelConnector();
- connector.setPort(port);
- server.setConnectors(new Connector[] { connector });
+ connector.setPort(port);
+ server.setConnectors(new Connector[] { connector });
- final WebAppContext webappcontext = new WebAppContext();
- String path = DevelopmentServerLauncher.class.getPackage()
- .getName().replace(".", File.separator);
- webappcontext.setDefaultsDescriptor(path + File.separator
- + "jetty-webdefault.xml");
- webappcontext.setContextPath(serverArgs.get("context"));
- webappcontext.setWar(serverArgs.get("webroot"));
- server.setHandler(webappcontext);
+ final WebAppContext webappcontext = new WebAppContext();
+ String path = DevelopmentServerLauncher.class.getPackage().getName()
+ .replace(".", File.separator);
+ webappcontext.setDefaultsDescriptor(path + File.separator
+ + "jetty-webdefault.xml");
+ webappcontext.setContextPath(serverArgs.get("context"));
+ webappcontext.setWar(serverArgs.get("webroot"));
+ server.setHandler(webappcontext);
+ try {
server.start();
- } catch (final Exception e) {
- e.printStackTrace();
- return null;
+ } catch (Exception e) {
+ server.stop();
+ throw e;
}
return "http://localhost:" + port + serverArgs.get("context");
|