Skip to content
Browse files

Merge pull request #263 from hvesalai/jetty9

Migrated scalatra-scalatest to jetty9
  • Loading branch information...
2 parents e449289 + 39993c4 commit a5fab6556d316a47f3b818ac12d1afb80657be3a @casualjim casualjim committed Mar 28, 2013
Showing with 10 additions and 6 deletions.
  1. +2 −2 project/build.scala
  2. +8 −4 test/src/main/scala/org/scalatra/test/EmbeddedJettyContainer.scala
View
4 project/build.scala
@@ -266,7 +266,7 @@ object ScalatraBuild extends Build {
lazy val jerkson = "io.backchat.jerkson" %% "jerkson" % "0.7.0"
lazy val jettyServer = "org.eclipse.jetty" % "jetty-server" % jettyVersion
lazy val jettyServlet = "org.eclipse.jetty" % "jetty-servlet" % jettyVersion
- lazy val jettyWebsocket = "org.eclipse.jetty" % "jetty-websocket" % jettyVersion
+ lazy val jettyWebsocket = "org.eclipse.jetty.websocket" % "websocket-server" % jettyVersion
lazy val jettyWebapp = "org.eclipse.jetty" % "jetty-webapp" % jettyVersion
lazy val jodaConvert = "org.joda" % "joda-convert" % "1.2"
lazy val jodaTime = "joda-time" % "joda-time" % "2.1"
@@ -309,7 +309,7 @@ object ScalatraBuild extends Build {
private val httpcomponentsVersion = "4.2.3"
- private val jettyVersion = "8.1.8.v20121106"
+ private val jettyVersion = "9.0.0.v20130308"
private val json4sVersion = "3.1.0"
View
12 test/src/main/scala/org/scalatra/test/EmbeddedJettyContainer.scala
@@ -1,6 +1,7 @@
package org.scalatra.test
import org.eclipse.jetty.server.Server
+import org.eclipse.jetty.server.ServerConnector
import org.eclipse.jetty.servlet.ServletContextHandler
trait EmbeddedJettyContainer extends JettyContainer {
@@ -11,10 +12,13 @@ trait EmbeddedJettyContainer extends JettyContainer {
/**
* The port of the currently running Jetty. May differ from port if port is 0.
- *
+ *
* @return Some port if Jetty is currently listening, or None if it is not.
*/
- def localPort: Option[Int] = server.getConnectors.headOption map { _.getLocalPort }
+ def localPort: Option[Int] = server.getConnectors.headOption map {
+ case conn: ServerConnector => conn.getLocalPort
+ case _ => sys.error("can't get local port")
+ }
def contextPath = "/"
@@ -36,11 +40,11 @@ trait EmbeddedJettyContainer extends JettyContainer {
def baseUrl: String =
server.getConnectors.headOption match {
- case Some(conn) =>
+ case Some(conn: ServerConnector) =>
val host = Option(conn.getHost) getOrElse "localhost"
val port = conn.getLocalPort
"http://%s:%d".format(host, port)
- case None =>
+ case _ =>
sys.error("can't calculate base URL: no connector")
}
}

0 comments on commit a5fab65

Please sign in to comment.
Something went wrong with that request. Please try again.