~ add some log infos on POSTs
authorAlexandre Bertails <bertails@w3.org>
Tue, 30 Aug 2011 16:08:50 -0400
changeset 31 400f0281cf7c
parent 30 c468ac3dd7de
child 32 a7b48131499f
child 41 7d4fdaad3a2a
~ add some log infos on POSTs
src/main/scala/Main.scala
--- a/src/main/scala/Main.scala	Tue Aug 30 15:51:01 2011 -0400
+++ b/src/main/scala/Main.scala	Tue Aug 30 16:08:50 2011 -0400
@@ -68,21 +68,26 @@
         case POST(_) =>
           try {
             Post.parse(Body.stream(req), baseURI) match {
-              case PostUnknown =>
+              case PostUnknown => {
+                logger.info("Couldn't parse the request")
                 BadRequest ~> ResponseString("You MUST provide valid content for either: SPARQL UPDATE, SPARQL Query, RDF/XML, TURTLE")
+              }
               case PostUpdate(update) => {
+                logger.info("SPARQL UPDATE:\n" + update.toString())
                 val model = r.get()
                 UpdateAction.execute(update, model)
                 r.save(model)
                 Ok
               }
               case PostRDF(diffModel) => {
+                logger.info("RDF content:\n" + diffModel.toString())
                 val model = r.get()
                 model.add(diffModel)
                 r.save(model)
                 Ok
               }
               case PostQuery(query) => {
+                logger.info("SPARQL Query:\n" + query.toString())
                 lazy val encoding = RDFEncoding(req)
                 val model:Model = r.get()
                 val qe:QueryExecution = QueryExecutionFactory.create(query, model)