From 7c105ab76efb54e915bc1487785c0e2b3208b0c5 Mon Sep 17 00:00:00 2001 From: Graeme Rocher Date: Thu, 17 Oct 2013 11:34:28 +0200 Subject: [PATCH] Revert "Support assigning 0 to http/https port for OS assigned port." This reverts commit e4c63c60c907766d68205e5156d15d9e3318631b. Conflicts: grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/fork/ForkedGrailsProcess.groovy grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/InlineExplodedTomcatServer.groovy grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/IsolatedTomcat.java grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/IsolatedWarTomcatServer.groovy grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/TomcatKillSwitch.java grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/TomcatServer.groovy grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/fork/ForkedTomcatServer.groovy scripts/_GrailsTest.groovy --- .../groovy/grails/cli/api/BaseSettingsApi.java | 14 -------------- .../project/container/GrailsProjectRunner.groovy | 8 ++------ scripts/StopApp.groovy | 2 +- scripts/_GrailsTest.groovy | 1 + 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/api/BaseSettingsApi.java b/grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/api/BaseSettingsApi.java index b97871a3895..c294fcf9ca1 100644 --- a/grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/api/BaseSettingsApi.java +++ b/grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/api/BaseSettingsApi.java @@ -144,26 +144,12 @@ public int getServerPort() { return serverPort; } - public void setServerPort(Integer port) { - if (port != null) { - System.setProperty("server.port", port.toString()); - System.setProperty("grails.server.port.http", port.toString()); - } - } - public int getServerPortHttps() { int serverPortHttps = Integer.valueOf(getPropertyValue("server.port.https", 8443).toString()); serverPortHttps = Integer.valueOf(getPropertyValue("grails.server.port.https", serverPortHttps).toString()); return serverPortHttps; } - public void setServerPortHttps(Integer port) { - if (port != null) { - System.setProperty("server.port.https", port.toString()); - System.setProperty("grails.server.port.https", port.toString()); - } - } - public String getServerHost() { return (String)getPropertyValue("grails.server.host", null); } diff --git a/grails-web/src/main/groovy/org/codehaus/groovy/grails/project/container/GrailsProjectRunner.groovy b/grails-web/src/main/groovy/org/codehaus/groovy/grails/project/container/GrailsProjectRunner.groovy index 8e9d48f1554..3e3471ec3b0 100644 --- a/grails-web/src/main/groovy/org/codehaus/groovy/grails/project/container/GrailsProjectRunner.groovy +++ b/grails-web/src/main/groovy/org/codehaus/groovy/grails/project/container/GrailsProjectRunner.groovy @@ -195,7 +195,7 @@ class GrailsProjectRunner extends BaseSettingsApi { EmbeddableServer runServer(Map args) { try { eventListener.triggerEvent("StatusUpdate","Running Grails application") - + def message = "Server running. Browse to http://${args.host ?: 'localhost'}:${args.httpPort}$serverContextPath" EmbeddableServer server = args["server"] if (server.hasProperty('eventListener')) { @@ -205,7 +205,6 @@ class GrailsProjectRunner extends BaseSettingsApi { server.grailsConfig = config } - def httpsMessage = "" profile("start server") { try { new ServerSocket(args.httpPort).close() } @@ -226,15 +225,12 @@ class GrailsProjectRunner extends BaseSettingsApi { server.startSecure args.host, args.httpPort, args.httpsPort // Update the message to reflect the fact we are running HTTPS as well. - setServerPortHttps(server.localHttpsPort) - httpsMessage = " or https://${args.host ?: 'localhost'}:${server.localHttpsPort}$serverContextPath" + message += " or https://${args.host ?: 'localhost'}:${args.httpsPort}$serverContextPath" } else { server.start args.host, args.httpPort } } - setServerPort(server.localHttpPort) - def message = "Server running. Browse to http://${args.host ?: 'localhost'}:${server.localHttpPort}$serverContextPath" + httpsMessage eventListener.triggerEvent("StatusFinal", message) boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1 diff --git a/scripts/StopApp.groovy b/scripts/StopApp.groovy index 717c15c625b..6c78202074c 100644 --- a/scripts/StopApp.groovy +++ b/scripts/StopApp.groovy @@ -29,7 +29,7 @@ target('default': "Stops a forked Grails application") { try { grailsConsole.updateStatus "Stopping Grails Server..." - def url = "http://${serverHost ?: 'localhost'}:${serverPort-1}" + def url = "http://${serverHost ?: 'localhost'}:${serverPort+1}" grailsConsole.verbose "URL to stop server is $url" new URL(url).getText(connectTimeout: 10000, readTimeout: 10000) grailsConsole.updateStatus "Server Stopped" diff --git a/scripts/_GrailsTest.groovy b/scripts/_GrailsTest.groovy index 12b33e95771..4bf968261cf 100644 --- a/scripts/_GrailsTest.groovy +++ b/scripts/_GrailsTest.groovy @@ -94,6 +94,7 @@ target(allTests: "Runs the project's tests.") { else { projectTestRunner.runAllTests(argsMap, false) } + } /**