Skip to content

Commit

Permalink
Revert "Support assigning 0 to http/https port for OS assigned port."
Browse files Browse the repository at this point in the history
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
  • Loading branch information
graemerocher committed Oct 17, 2013
1 parent 230b780 commit 7c105ab
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
Expand Up @@ -144,26 +144,12 @@ public int getServerPort() {
return serverPort; 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() { public int getServerPortHttps() {
int serverPortHttps = Integer.valueOf(getPropertyValue("server.port.https", 8443).toString()); int serverPortHttps = Integer.valueOf(getPropertyValue("server.port.https", 8443).toString());
serverPortHttps = Integer.valueOf(getPropertyValue("grails.server.port.https", serverPortHttps).toString()); serverPortHttps = Integer.valueOf(getPropertyValue("grails.server.port.https", serverPortHttps).toString());
return serverPortHttps; 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() { public String getServerHost() {
return (String)getPropertyValue("grails.server.host", null); return (String)getPropertyValue("grails.server.host", null);
} }
Expand Down
Expand Up @@ -195,7 +195,7 @@ class GrailsProjectRunner extends BaseSettingsApi {
EmbeddableServer runServer(Map args) { EmbeddableServer runServer(Map args) {
try { try {
eventListener.triggerEvent("StatusUpdate","Running Grails application") eventListener.triggerEvent("StatusUpdate","Running Grails application")

def message = "Server running. Browse to http://${args.host ?: 'localhost'}:${args.httpPort}$serverContextPath"


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


def httpsMessage = ""
profile("start server") { profile("start server") {


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


// Update the message to reflect the fact we are running HTTPS as well. // Update the message to reflect the fact we are running HTTPS as well.
setServerPortHttps(server.localHttpsPort) message += " or https://${args.host ?: 'localhost'}:${args.httpsPort}$serverContextPath"
httpsMessage = " or https://${args.host ?: 'localhost'}:${server.localHttpsPort}$serverContextPath"
} }
else { else {
server.start args.host, args.httpPort 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) eventListener.triggerEvent("StatusFinal", message)


boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1 boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") != -1
Expand Down
2 changes: 1 addition & 1 deletion scripts/StopApp.groovy
Expand Up @@ -29,7 +29,7 @@ target('default': "Stops a forked Grails application") {


try { try {
grailsConsole.updateStatus "Stopping Grails Server..." 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" grailsConsole.verbose "URL to stop server is $url"
new URL(url).getText(connectTimeout: 10000, readTimeout: 10000) new URL(url).getText(connectTimeout: 10000, readTimeout: 10000)
grailsConsole.updateStatus "Server Stopped" grailsConsole.updateStatus "Server Stopped"
Expand Down
1 change: 1 addition & 0 deletions scripts/_GrailsTest.groovy
Expand Up @@ -94,6 +94,7 @@ target(allTests: "Runs the project's tests.") {
else { else {
projectTestRunner.runAllTests(argsMap, false) projectTestRunner.runAllTests(argsMap, false)
} }

} }


/** /**
Expand Down

0 comments on commit 7c105ab

Please sign in to comment.