Author: sco...@google.com Date: Thu Dec 11 19:02:11 2008 New Revision: 4317
Modified: releases/1.6/dev/core/src/com/google/gwt/dev/GWTShell.java releases/1.6/dev/core/src/com/google/gwt/dev/HostedMode.java releases/1.6/dev/core/src/com/google/gwt/dev/HostedModeBase.java Log: Makes hosted mode really, really work with -noserver when the remote process is serving from your WAR folder. - The reason for the refactor is that the code now captured in HostedMode.doStartup() was not getting run in -noserver mode - Will sort in a follow-up commit. Review by: bobv Modified: releases/1.6/dev/core/src/com/google/gwt/dev/GWTShell.java ============================================================================== --- releases/1.6/dev/core/src/com/google/gwt/dev/GWTShell.java (original) +++ releases/1.6/dev/core/src/com/google/gwt/dev/GWTShell.java Thu Dec 11 19:02:11 2008 @@ -194,13 +194,14 @@ } @Override - protected void shutDownServer() { + protected void doShutDownServer() { // Stop the HTTP server. // EmbeddedTomcatServer.stop(); } - protected int startUpServer() { + @Override + protected int doStartUpServer() { // TODO(bruce): make tomcat work in terms of the modular launcher String whyFailed = EmbeddedTomcatServer.start(getTopLogger(), getPort(), options); Modified: releases/1.6/dev/core/src/com/google/gwt/dev/HostedMode.java ============================================================================== --- releases/1.6/dev/core/src/com/google/gwt/dev/HostedMode.java (original) +++ releases/1.6/dev/core/src/com/google/gwt/dev/HostedMode.java Thu Dec 11 19:02:11 2008 @@ -269,7 +269,7 @@ } @Override - protected void shutDownServer() { + protected void doShutDownServer() { if (server != null) { try { server.stop(); @@ -285,7 +285,10 @@ } @Override - protected int startUpServer() { + protected boolean doStartup() { + if (!super.doStartup()) { + return false; + } tempWorkDir = options.getWorkDir() == null; if (tempWorkDir) { try { @@ -293,7 +296,7 @@ } catch (IOException e) { System.err.println("Unable to create hosted mode work directory"); e.printStackTrace(); - return -1; + return false; } } @@ -314,10 +317,14 @@ link(loadLogger, module, false); } catch (UnableToCompleteException e) { // Already logged. - return -1; + return false; } } + return true; + } + @Override + protected int doStartUpServer() { try { TreeLogger serverLogger = getTopLogger().branch(TreeLogger.INFO, "Starting HTTP on port " + getPort(), null); Modified: releases/1.6/dev/core/src/com/google/gwt/dev/HostedModeBase.java ============================================================================== --- releases/1.6/dev/core/src/com/google/gwt/dev/HostedModeBase.java (original) +++ releases/1.6/dev/core/src/com/google/gwt/dev/HostedModeBase.java Thu Dec 11 19:02:11 2008 @@ -530,6 +530,18 @@ return true; } + protected boolean doStartup() { + loadRequiredNativeLibs(); + + // Create the main app window. + openAppWindow(); + + // Initialize the logger. + // + initializeLogger(); + return true; + } + /** * Derived classes can override to set a default port. */ @@ -622,11 +634,9 @@ if (!runTomcat) { return; } - shutDownServer(); + doShutDownServer(); } - protected abstract void shutDownServer(); - protected void sleep() { display.sleep(); } @@ -638,17 +648,12 @@ started = true; - loadRequiredNativeLibs(); - - // Create the main app window. - openAppWindow(); - - // Initialize the logger. - // - initializeLogger(); + if (!doStartup()) { + return false; + } if (runTomcat) { - int resultPort = startUpServer(); + int resultPort = doStartUpServer(); if (resultPort < 0) { return false; } @@ -658,7 +663,9 @@ return true; } - protected abstract int startUpServer(); + protected abstract void doShutDownServer(); + + protected abstract int doStartUpServer(); private Shell createTrackedBrowserShell() { final Shell shell = new Shell(display); --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---