diff --git a/dev-mode/run-support/src/main/scala/play/runsupport/Reloader.scala b/dev-mode/run-support/src/main/scala/play/runsupport/Reloader.scala index 7020beb3049..95ef41582b7 100644 --- a/dev-mode/run-support/src/main/scala/play/runsupport/Reloader.scala +++ b/dev-mode/run-support/src/main/scala/play/runsupport/Reloader.scala @@ -291,7 +291,18 @@ object Reloader { val server = { val mainClass = applicationLoader.loadClass(mainClassName) - if (httpPort.isDefined) { + if (httpPort.isDefined && httpsPort.isDefined) { + val mainDev = mainClass.getMethod( + "mainDevHttpAndHttpsMode", + classOf[BuildLink], + classOf[Int], + classOf[Int], + classOf[String] + ) + mainDev + .invoke(null, reloader, httpPort.get: java.lang.Integer, httpsPort.get: java.lang.Integer, httpAddress) + .asInstanceOf[play.core.server.ReloadableServer] + } else if (httpPort.isDefined) { val mainDev = mainClass.getMethod("mainDevHttpMode", classOf[BuildLink], classOf[Int], classOf[String]) mainDev .invoke(null, reloader, httpPort.get: java.lang.Integer, httpAddress) diff --git a/transport/server/play-server/src/main/scala/play/core/server/DevServerStart.scala b/transport/server/play-server/src/main/scala/play/core/server/DevServerStart.scala index 0f850f9b3dc..6b95bc8d5af 100644 --- a/transport/server/play-server/src/main/scala/play/core/server/DevServerStart.scala +++ b/transport/server/play-server/src/main/scala/play/core/server/DevServerStart.scala @@ -47,7 +47,22 @@ object DevServerStart { * compiled with different versions of Scala. */ def mainDevHttpMode(buildLink: BuildLink, httpPort: Int, httpAddress: String): ReloadableServer = { - mainDev(buildLink, Some(httpPort), Option(System.getProperty("https.port")).map(Integer.parseInt), httpAddress) + mainDev(buildLink, Some(httpPort), None, httpAddress) + } + + /** + * Provides an HTTP and HTTPS server for the dev environment + * + *

This method uses simple Java types so that it can be used with reflection by code + * compiled with different versions of Scala. + */ + def mainDevHttpAndHttpsMode( + buildLink: BuildLink, + httpPort: Int, + httpsPort: Int, + httpAddress: String + ): ReloadableServer = { + mainDev(buildLink, Some(httpPort), Some(httpsPort), httpAddress) } private def mainDev(