From c792c706bbe50319802f47d76c1c549947f359f3 Mon Sep 17 00:00:00 2001 From: Graeme Rocher Date: Fri, 20 Jul 2012 11:02:23 +0200 Subject: [PATCH] Fixed run-app --https with forked JVM --- .../tomcat/fork/ForkedTomcatServer.groovy | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/fork/ForkedTomcatServer.groovy b/grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/fork/ForkedTomcatServer.groovy index f6b3d74a061..dd54319a749 100644 --- a/grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/fork/ForkedTomcatServer.groovy +++ b/grails-plugin-tomcat/src/main/groovy/org/grails/plugins/tomcat/fork/ForkedTomcatServer.groovy @@ -66,7 +66,12 @@ class ForkedTomcatServer extends ForkedGrailsProcess implements EmbeddableServer initializeLogging(ec.grailsHome,classLoader) tomcatRunner = new TomcatRunner("$buildSettings.baseDir/web-app", buildSettings.webXmlLocation.absolutePath, ec.contextPath, classLoader) - tomcatRunner.start(ec.host, ec.port) + if(ec.securePort > 0) { + tomcatRunner.startSecure(ec.host, ec.port, ec.securePort) + } + else { + tomcatRunner.start(ec.host, ec.port) + } setupReloading(classLoader, buildSettings) @@ -77,9 +82,15 @@ class ForkedTomcatServer extends ForkedGrailsProcess implements EmbeddableServer @CompileStatic void start(String host, int port) { + startSecure(host, port, 0) + } + + @CompileStatic + void startSecure(String host, int httpPort, int httpsPort) { final ec = executionContext ec.host = host - ec.port = port + ec.port = httpPort + ec.securePort = httpsPort def t = new Thread( { final process = fork() Runtime.addShutdownHook { @@ -91,6 +102,7 @@ class ForkedTomcatServer extends ForkedGrailsProcess implements EmbeddableServer System.setProperty(TomcatKillSwitch.TOMCAT_KILL_SWITCH_ACTIVE, "true") } + @CompileStatic boolean isAvailable(String host, int port) { try { @@ -160,6 +172,6 @@ class TomcatExecutionContext extends ExecutionContext implements Serializable { String contextPath String host = EmbeddableServer.DEFAULT_HOST int port = EmbeddableServer.DEFAULT_PORT - int securePort = EmbeddableServer.DEFAULT_SECURE_PORT + int securePort }