Skip to content

Commit 46d9cc4

Browse files
committed
Merge branch '2.2.x' into 2.3.x
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 grails-plugin-url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/filter/UrlMappingsFilter.java scripts/_GrailsTest.groovy
2 parents a05ea02 + e52f4c9 commit 46d9cc4

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,26 @@ 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+
147154
public int getServerPortHttps() {
148155
int serverPortHttps = Integer.valueOf(getPropertyValue("server.port.https", 8443).toString());
149156
serverPortHttps = Integer.valueOf(getPropertyValue("grails.server.port.https", serverPortHttps).toString());
150157
return serverPortHttps;
151158
}
152159

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+
153167
public String getServerHost() {
154168
return (String)getPropertyValue("grails.server.host", null);
155169
}

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

Lines changed: 6 additions & 2 deletions
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-
def message = "Server running. Browse to http://${args.host ?: 'localhost'}:${args.httpPort}$serverContextPath"
198+
199199

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

208+
def httpsMessage = ""
208209
profile("start server") {
209210

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

227228
// Update the message to reflect the fact we are running HTTPS as well.
228-
message += " or https://${args.host ?: 'localhost'}:${args.httpsPort}$serverContextPath"
229+
setServerPortHttps(server.localHttpsPort)
230+
httpsMessage = " or https://${args.host ?: 'localhost'}:${server.localHttpsPort}$serverContextPath"
229231
}
230232
else {
231233
server.start args.host, args.httpPort
232234
}
233235
}
236+
setServerPort(server.localHttpPort)
237+
def message = "Server running. Browse to http://${args.host ?: 'localhost'}:${server.localHttpPort}$serverContextPath" + httpsMessage
234238
eventListener.triggerEvent("StatusFinal", message)
235239

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

scripts/StopApp.groovy

Lines changed: 1 addition & 1 deletion
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"

0 commit comments

Comments
 (0)