+ POST
authorAlexandre Bertails <bertails@w3.org>
Mon, 22 Aug 2011 15:04:55 -0400
changeset 8 a576ef67fea1
parent 6 8aba95009ca5
child 9 143c3ea32569
+ POST
src/main/scala/Main.scala
--- a/src/main/scala/Main.scala	Mon Aug 22 14:29:53 2011 -0400
+++ b/src/main/scala/Main.scala	Mon Aug 22 15:04:55 2011 -0400
@@ -15,13 +15,8 @@
   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 port = args.toList.headOption map { _.toInt } getOrElse 2719
     
     val echo = unfiltered.filter.Planify {
       case Path(Seg(p :: Nil)) => ResponseString(p)
@@ -29,12 +24,17 @@
 
     val app = unfiltered.filter.Planify {
        case req @ Path(Seg("tracker" :: Nil)) => Ok ~> ContentType("application/xhtml+xml") ~> Scalate(req, "geolocation.ssp")
+       case req @ POST(Path(Seg("user" :: user :: "run" :: Nil))) => {
+         val body = Body.string(req)
+         logger.info(body)
+         ResponseString(body)
+       }
     }
 
     import javax.servlet._
     import javax.servlet.http._
     
-    unfiltered.jetty.Http(2719).filter {
+    unfiltered.jetty.Http(port).filter {
       new Filter {
         def destroy():Unit = ()
         def doFilter(request:ServletRequest, response:ServletResponse, chain:FilterChain):Unit = {