--- a/.hgignore Mon Aug 22 11:49:39 2011 -0400
+++ b/.hgignore Mon Aug 22 14:28:09 2011 -0400
@@ -14,3 +14,4 @@
src/main/scala.egp
src/test/scala.egp
sbt-launch.jar
+.scala_dependencies
\ No newline at end of file
--- a/project/Build.scala Mon Aug 22 11:49:39 2011 -0400
+++ b/project/Build.scala Mon Aug 22 14:28:09 2011 -0400
@@ -9,6 +9,7 @@
val unfiltered_filter = "net.databinder" %% "unfiltered-filter" % "0.4.1"
val unfiltered_jetty = "net.databinder" %% "unfiltered-jetty" % "0.4.1"
val unfiltered_scalate = "net.databinder" %% "unfiltered-scalate" % "0.4.1"
+ val slf4jSimple = "org.slf4j" % "slf4j-simple" % "1.6.1"
}
object BuildSettings {
@@ -41,7 +42,8 @@
libraryDependencies += dispatch,
libraryDependencies += unfiltered_filter,
libraryDependencies += unfiltered_jetty,
- libraryDependencies += unfiltered_scalate
+ libraryDependencies += unfiltered_scalate,
+ libraryDependencies += slf4jSimple
)
lazy val virtual_trainer = Project(
--- a/project/build/Project.scala Mon Aug 22 11:49:39 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-import sbt._
-
-class Project(info: ProjectInfo) extends DefaultProject(info) {
-
- val scalatools = "scala-tools" at "http://scala-tools.org/repo-snapshots"
- val smackRepo = "m2-repository-smack" at "http://maven.reucon.com/public"
- val databinder_net = "databinder.net repository" at "http://databinder.net/repo"
-
- val scalatest = "org.scalatest" % "scalatest" % "1.0.1-for-scala-2.8.0.Beta1-with-test-interfaces-0.3-SNAPSHOT" % "test->default"
- val jodatime = "joda-time" % "joda-time" % "1.6"
- val dispatch = "net.databinder" %% "dispatch-http" % "0.7.1"
-
- val jtidy = "jtidy" % "jtidy" % "r938" from "http://downloads.sourceforge.net/project/jtidy/JTidy/r938/jtidy-r938.jar"
- val saxon = "saxon" % "saxon" % "9.2.0.5j" from "http://www.bertails.org/jar/saxonhe9-2-0-5j.jar"
-
- val scardf = "W3C" % "scardf-2.8_2.8.0.Beta1" % "0.2"
-
-}
--- a/project/plugins/build.sbt Mon Aug 22 11:49:39 2011 -0400
+++ b/project/plugins/build.sbt Mon Aug 22 14:28:09 2011 -0400
@@ -1,1 +1,11 @@
libraryDependencies <+= (sbtVersion) { sv => "com.eed3si9n" %% "sbt-assembly" % ("sbt" + sv + "_0.4") }
+
+resolvers += {
+ val typesafeRepoUrl = new java.net.URL("http://repo.typesafe.com/typesafe/releases")
+ val pattern = Patterns(false, "[organisation]/[module]/[sbtversion]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]")
+ Resolver.url("Typesafe Repository", typesafeRepoUrl)(pattern)
+}
+
+libraryDependencies <<= (libraryDependencies, sbtVersion) { (deps, version) =>
+ deps :+ ("com.typesafe.sbteclipse" %% "sbteclipse" % "1.3-RC3" extra("sbtversion" -> version))
+}
--- a/src/main/scala/Main.scala Mon Aug 22 11:49:39 2011 -0400
+++ b/src/main/scala/Main.scala Mon Aug 22 14:28:09 2011 -0400
@@ -7,24 +7,52 @@
import java.io.File
+import org.slf4j.{Logger, LoggerFactory}
+
+
object VirtualTrainerApp {
+ val logger:Logger = LoggerFactory.getLogger(this.getClass)
+
def main(args: Array[String]) {
+ val log = {
+ println("toto")
+ unfiltered.filter.Planify {
+ case Path(Seg(p :: Nil)) => ResponseString(p)
+ }
+ }
+
val echo = unfiltered.filter.Planify {
case Path(Seg(p :: Nil)) => ResponseString(p)
}
- val test = unfiltered.filter.Planify {
- case req @ Path(Seg("test" :: Nil)) => Ok ~> Scalate(req, "geolocation.ssp")
+ val app = unfiltered.filter.Planify {
+ case req @ Path(Seg("tracker" :: Nil)) => Ok ~> ContentType("application/xhtml+xml") ~> Scalate(req, "geolocation.ssp")
}
- unfiltered.jetty.Http(2719).context("/scripts"){ ctx:ContextBuilder =>
+ import javax.servlet._
+ import javax.servlet.http._
+
+ unfiltered.jetty.Http(2719).filter {
+ new Filter {
+ def destroy():Unit = ()
+ def doFilter(request:ServletRequest, response:ServletResponse, chain:FilterChain):Unit = {
+ val r:HttpServletRequest = request.asInstanceOf[HttpServletRequest]
+ val method = r.getMethod
+ val uri = r.getRequestURI
+ logger.info("%s %s" format (method, uri))
+ chain.doFilter(request, response)
+ }
+ def init(filterConfig:FilterConfig):Unit = ()
+ }
+ }.context("/scripts"){ ctx:ContextBuilder =>
ctx.resources(new File("src/main/resources/scripts").toURI.toURL)
}.context("/styles"){ ctx:ContextBuilder =>
ctx.resources(new File("src/main/resources/styles").toURI.toURL)
- }.filter(test).filter(echo).run()
+ }.filter(app).filter(echo).run()
+
}
}