Skip to content

Commit

Permalink
Merge branch 'develop_2.9' into develop_2.10
Browse files Browse the repository at this point in the history
Conflicts:
	project/build.scala
  • Loading branch information
rossabaker committed Jan 15, 2013
2 parents 7085739 + 9ac73c8 commit 5ca96b1
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 66 deletions.
13 changes: 6 additions & 7 deletions core/src/main/scala/org/scalatra/servlet/ServletBase.scala
Expand Up @@ -25,14 +25,13 @@ trait ServletBase
protected implicit def configWrapper(config: ConfigT) = new Config {
def context = config.getServletContext

object initParameters extends DefaultMap[String, String] {
def get(key: String): Option[String] =
Option(config.getInitParameter(key))
object initParameters extends DefaultMap[String, String] {
def get(key: String): Option[String] = Option(config.getInitParameter(key))

def iterator: Iterator[(String, String)] =
for (name <- config.getInitParameterNames.asScala.toIterator)
yield (name, config.getInitParameter(name))
}
def iterator: Iterator[(String, String)] =
for (name <- config.getInitParameterNames.asScala.toIterator)
yield (name, config.getInitParameter(name))
}
}

override def addSessionId(uri: String) = response.encodeURL(uri)
Expand Down
Expand Up @@ -112,15 +112,9 @@ class FileUploadSupportMaxSizeTestServlet extends ScalatraServlet with FileUploa
}

class FileUploadSupportSpec extends MutableScalatraSpec {
private def addMultipartServlet(servlet: HttpServlet, mapping: String, maxSize: Long) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=395000
val holder = new ServletHolder(servlet)
holder.getRegistration.setMultipartConfig(new MultipartConfigElement("", maxSize, -1, 1024*1024*1024))
servletContextHandler.addServlet(holder, mapping)
}

addMultipartServlet(new FileUploadSupportSpecServlet, "/*", 4096L)
addMultipartServlet(new FileUploadSupportMaxSizeTestServlet, "/max-size/*", 1024L)
mount(new FileUploadSupportSpecServlet, "/*")
mount(new FileUploadSupportMaxSizeTestServlet, "/max-size/*")

def postExample[A](f: => A): A = {
val params = Map("param1" -> "one", "param2" -> "two")
Expand Down
Expand Up @@ -54,13 +54,7 @@ class FileUploadTestHelpersTestServlet extends ScalatraServlet with FileUploadSu
}

class FileUploadTestHelpersTest extends ScalatraFunSuite {
private def addMultipartServlet(servlet: HttpServlet, mapping: String, maxSize: Long = 0L) {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=395000
val holder = new ServletHolder(servlet)
holder.getRegistration.setMultipartConfig(new MultipartConfigElement("", maxSize, -1, 1024*1024*1024))
servletContextHandler.addServlet(holder, mapping)
}
addMultipartServlet(new FileUploadTestHelpersTestServlet, "/*")
mount(new FileUploadTestHelpersTestServlet, "/*")

val files = Map(
"textFile" -> new File("core/src/test/resources/org/scalatra/servlet/lorem_ipsum.txt"),
Expand Down
1 change: 1 addition & 0 deletions crosspaths.sbt
@@ -0,0 +1 @@
crossPaths in ThisBuild := false
2 changes: 1 addition & 1 deletion json/src/main/scala/org/scalatra/json/JValueResult.scala
Expand Up @@ -20,7 +20,7 @@ trait JValueResult extends ScalatraSyntax { self: JsonSupport[_] =>
case status: Int => super.renderPipeline(status)
case bytes: Array[Byte] => super.renderPipeline(bytes)
case is: java.io.InputStream => super.renderPipeline(is)
case file: File => super.renderPipeline
case file: File => super.renderPipeline(file)
case a: ActionResult => super.renderPipeline(a)
case _: Unit | Unit => super.renderPipeline(())
case s: String => super.renderPipeline(s)
Expand Down
55 changes: 14 additions & 41 deletions project/build.scala
Expand Up @@ -9,25 +9,25 @@ object ScalatraBuild extends Build {
import Dependencies._
import Resolvers._

lazy val majorVersion = "2.2"

lazy val scalatraSettings = Defaults.defaultSettings ++ ls.Plugin.lsSettings ++ Seq(
organization := "org.scalatra",
version := "%s.0-SNAPSHOT" format majorVersion,
crossScalaVersions := Seq("2.10.0"),
scalaVersion <<= (crossScalaVersions) { versions => versions.head },
scalacOptions ++= Seq("-unchecked", "-deprecation"),
javacOptions ++= Seq("-target", "1.6", "-source", "1.6"),
scalacOptions ++= Seq("-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8"),
javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-Xlint:deprecation"),
manifestSetting,
publishSetting,
crossPaths := true,
resolvers ++= Seq(sonatypeNexusSnapshots),
(LsKeys.tags in LsKeys.lsync) := Seq("web", "sinatra"),
(LsKeys.docsUrl in LsKeys.lsync) := Some(new URL("http://www.scalatra.org/%s/book/" format majorVersion))
) ++ mavenCentralFrouFrou ++ jettyOrbitHack
(LsKeys.tags in LsKeys.lsync) := Seq("web", "sinatra", "scalatra"),
(LsKeys.docsUrl in LsKeys.lsync) <<= (version){ v =>
val majorVersion = v.split(".").dropRight(1).mkString(".")
Some(new URL("http://www.scalatra.org/%s/book/" format majorVersion))
}
) ++ mavenCentralFrouFrou

lazy val scalatraProject = Project(
id = "scalatra-project",
id = "scalatra-projecScent",
base = file("."),
settings = scalatraSettings ++ Unidoc.unidocSettings ++ doNotPublish ++ Seq(
description := "A tiny, Sinatra-like web framework for Scala",
Expand Down Expand Up @@ -230,8 +230,8 @@ object ScalatraBuild extends Build {
base = file("example"),
settings = scalatraSettings ++ webSettings ++ doNotPublish ++ Seq(
resolvers ++= Seq(sonatypeNexusSnapshots),
libraryDependencies += servletApi % "test",
libraryDependencies += jettyWebsocket,
libraryDependencies += servletApi % "container;test",
libraryDependencies += jettyWebsocket % "container;test",
libraryDependencies ++= Seq(jettyWebapp % "container;test", slf4jSimple),
libraryDependencies += json4sJackson,
description := "Scalatra example project"
Expand Down Expand Up @@ -264,7 +264,6 @@ object ScalatraBuild extends Build {
// Sort by artifact ID.
lazy val akkaActor: MM = sv => "com.typesafe.akka" %% "akka-actor" % akkaVersion(sv)
lazy val akkaTestkit: MM = sv => "com.typesafe.akka" %% "akka-testkit" % akkaVersion(sv)
lazy val antiXml: MM = sv => antiXmlGroup(sv) %% "anti-xml" % antiXmlVersion(sv)
lazy val atmosphereRuntime = "org.atmosphere" % "atmosphere-runtime" % "1.0.8"
lazy val base64 = "net.iharder" % "base64" % "2.3.8"
lazy val commonsFileupload = "commons-fileupload" % "commons-fileupload" % "1.2.2"
Expand All @@ -287,13 +286,13 @@ object ScalatraBuild extends Build {
lazy val json4sNative = "org.json4s" %% "json4s-native" % json4sVersion
lazy val junit = "junit" % "junit" % "4.11"
lazy val logbackClassic = "ch.qos.logback" % "logback-classic" % "1.0.9"
lazy val mockitoAll = "org.mockito" % "mockito-all" % "1.8.5"
lazy val mockitoAll = "org.mockito" % "mockito-all" % "1.9.5"
lazy val rl = "org.scalatra.rl" %% "rl" % "0.4.1"
lazy val scalajCollection = "org.scalaj" %% "scalaj-collection" % "1.2"
lazy val scalate: MM = sv => "org.fusesource.scalate" % scalateArtifact(sv) % scalateVersion(sv)
lazy val scalatest: MM = sv => "org.scalatest" %% "scalatest" % scalatestVersion(sv)
lazy val scalaz = "org.scalaz" %% "scalaz-core" % "6.0.4"
lazy val servletApi = "javax.servlet" % "javax.servlet-api" % "3.0.1"
lazy val servletApi = "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" artifacts (Artifact("javax.servlet", "jar", "jar"))
lazy val slf4jSimple = "org.slf4j" % "slf4j-simple" % "1.7.2"
lazy val socketioCore = "org.scalatra.socketio-java" % "socketio-core" % "2.0.0"
lazy val specs: MM = sv => "org.scala-tools.testing" % "specs" % specsVersion(sv) cross specsCross
Expand All @@ -305,27 +304,12 @@ object ScalatraBuild extends Build {

type MM = String => ModuleID

// Now entering Cross Build Hell

private val akkaVersion: String => String = {
case "2.9.1" => "2.0.2"
case "2.9.2" => "2.0.5"
case _ => "2.1.0"
}

private val antiXmlGroup: String => String = {
case sv if sv startsWith "2.8." => "com.codecommit"
case "2.9.0-1" => "com.codecommit"
case "2.9.1" => "com.codecommit"
case _ => "no.arktekk"
}
private val antiXmlVersion: String => String = {
case sv if sv startsWith "2.8." => "0.2"
case "2.9.0-1" => "0.3"
case "2.9.1" => "0.3"
case _ => "0.5.1"
}

private val grizzledSlf4jVersion: String => String = {
case sv if sv startsWith "2.9." => "0.6.10"
case _ => "1.0.1"
Expand Down Expand Up @@ -495,16 +479,5 @@ object ScalatraBuild extends Build {

lazy val doNotPublish = Seq(publish := {}, publishLocal := {})

// http://jira.codehaus.org/browse/JETTY-1493
// https://issues.apache.org/jira/browse/IVY-899
//
// This prevents Ivy from attempting to resolve these dependencies,
// but does not put the exclusions in the pom. For that, every
// module that depends on this atrocity needs an explicit exclude
// statement.
lazy val jettyOrbitHack = Seq(
ivyXML := <dependencies>
<exclude org="org.eclipse.jetty.orbit" />
</dependencies>
)

}
3 changes: 1 addition & 2 deletions project/plugins.sbt
@@ -1,8 +1,7 @@
scalacOptions ++= Seq("-unchecked", "-deprecation")

resolvers ++= Seq(
"less is" at "http://repo.lessis.me",
"coda" at "http://repo.plugcodahale.com"
"less is" at "http://repo.lessis.me"
)

libraryDependencies <+= sbtVersion(v => v match {
Expand Down
3 changes: 3 additions & 0 deletions version.sbt
@@ -0,0 +1,3 @@
import sbt._

version in ThisBuild := "2.2.0-SNAPSHOT"

0 comments on commit 5ca96b1

Please sign in to comment.