Skip to content

Commit 7c105ab

Browse files
committed
Revert "Support assigning 0 to http/https port for OS assigned port."
This reverts commit e4c63c6. 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
1 parent 230b780 commit 7c105ab

File tree

4 files changed

+4
-21
lines changed

4 files changed

+4
-21
lines changed

grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/api/BaseSettingsApi.java

-14
Original file line numberDiff line numberDiff line change
@@ -144,26 +144,12 @@ public int getServerPort() {
144144
return serverPort;
145145
}
146146

147-
public void setServerPort(Integer port) {
148-
if (port != null) {
149-
System.setProperty("server.port", port.toString());
150-
System.setProperty("grails.server.port.http", port.toString());
151-
}
152-
}
153-
154147
public int getServerPortHttps() {
155148
int serverPortHttps = Integer.valueOf(getPropertyValue("server.port.https", 8443).toString());
156149
serverPortHttps = Integer.valueOf(getPropertyValue("grails.server.port.https", serverPortHttps).toString());
157150
return serverPortHttps;
158151
}
159152

160-
public void setServerPortHttps(Integer port) {
161-
if (port != null) {
162-
System.setProperty("server.port.https", port.toString());
163-
System.setProperty("grails.server.port.https", port.toString());
164-
}
165-
}
166-
167153
public String getServerHost() {
168154
return (String)getPropertyValue("grails.server.host", null);
169155
}

grails-web/src/main/groovy/org/codehaus/groovy/grails/project/container/GrailsProjectRunner.groovy

+2-6
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class GrailsProjectRunner extends BaseSettingsApi {
195195
EmbeddableServer runServer(Map args) {
196196
try {
197197
eventListener.triggerEvent("StatusUpdate","Running Grails application")
198-
198+
def message = "Server running. Browse to http://${args.host ?: 'localhost'}:${args.httpPort}$serverContextPath"
199199

200200
EmbeddableServer server = args["server"]
201201
if (server.hasProperty('eventListener')) {
@@ -205,7 +205,6 @@ class GrailsProjectRunner extends BaseSettingsApi {
205205
server.grailsConfig = config
206206
}
207207

208-
def httpsMessage = ""
209208
profile("start server") {
210209

211210
try { new ServerSocket(args.httpPort).close() }
@@ -226,15 +225,12 @@ class GrailsProjectRunner extends BaseSettingsApi {
226225
server.startSecure args.host, args.httpPort, args.httpsPort
227226

228227
// Update the message to reflect the fact we are running HTTPS as well.
229-
setServerPortHttps(server.localHttpsPort)
230-
httpsMessage = " or https://${args.host ?: 'localhost'}:${server.localHttpsPort}$serverContextPath"
228+
message += " or https://${args.host ?: 'localhost'}:${args.httpsPort}$serverContextPath"
231229
}
232230
else {
233231
server.start args.host, args.httpPort
234232
}
235233
}
236-
setServerPort(server.localHttpPort)
237-
def message = "Server running. Browse to http://${args.host ?: 'localhost'}:${server.localHttpPort}$serverContextPath" + httpsMessage
238234
eventListener.triggerEvent("StatusFinal", message)
239235

240236
boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1

scripts/StopApp.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ target('default': "Stops a forked Grails application") {
2929

3030
try {
3131
grailsConsole.updateStatus "Stopping Grails Server..."
32-
def url = "http://${serverHost ?: 'localhost'}:${serverPort-1}"
32+
def url = "http://${serverHost ?: 'localhost'}:${serverPort+1}"
3333
grailsConsole.verbose "URL to stop server is $url"
3434
new URL(url).getText(connectTimeout: 10000, readTimeout: 10000)
3535
grailsConsole.updateStatus "Server Stopped"

scripts/_GrailsTest.groovy

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ target(allTests: "Runs the project's tests.") {
9494
else {
9595
projectTestRunner.runAllTests(argsMap, false)
9696
}
97+
9798
}
9899

99100
/**

0 commit comments

Comments
 (0)