changeset 37:04a0e6c30b3c

~ the app understands the parameters for the manual mode
author Alexandre Bertails <bertails@w3.org>
date Thu, 11 Aug 2011 17:21:36 -0400
parents 9d5d92029b3c
children 514d9e5e13b0
files src/main/scala/Main.scala
diffstat 1 files changed, 7 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/scala/Main.scala	Thu Aug 11 11:42:38 2011 +0200
+++ b/src/main/scala/Main.scala	Thu Aug 11 17:21:36 2011 -0400
@@ -106,8 +106,9 @@
 
         //val spec = "http://www.w3.org/TR/2004/WD-i18n-html-tech-char-20040509/"
         val spec = params("uri").head
+        val paramsNoURI = params - "uri" map { case(k, v) => (k, v.head) }
 
-        val xsltParams:Map[String, String] =
+        val defaultParams:Map[String, String] =
           Map(
             "uimode" -> "checker_full",
             "docstatus" -> "ord-wd-tr",
@@ -120,7 +121,7 @@
             "nscheckmanual" -> "",
             "display" -> "all",
             "recursive" -> "off",
-            "recurse_auth" -> "on") // ++ ( params map { case(k, v) => (k, v.head) } )
+            "recurse_auth" -> "on")
         // 13-pubrules-src.html | 13-pubrules.xsl -> xsl1
         // param: uri
 
@@ -136,7 +137,7 @@
         val trans1:XsltTransformer = exp1.load()
         trans1.setInitialContextNode(source1)
         trans1.setParameter(new QName("", "", "uri"), new XdmAtomicValue(spec))
-        xsltParams foreach { case (k, v) => trans1.setParameter(new QName("", "", k), new XdmAtomicValue(v))}
+        (defaultParams ++ paramsNoURI + ( "uri" -> spec )) foreach { case (k, v) => trans1.setParameter(new QName("", "", k), new XdmAtomicValue(v))}
 
         // xsl1 | frame.xsl -> xsl2
         val frame = "http://www.w3.org/2005/09/checker/frame.xsl"
@@ -166,8 +167,8 @@
             val doc:XdmNode =
               proc.newDocumentBuilder().build(new StreamSource(new URL(spec).openStream()))
             trans3.setInitialContextNode(doc)
-            trans3.setParameter(new QName("", "", "doc_uri"), new XdmAtomicValue(spec))
-            xsltParams foreach { case (k, v) => trans3.setParameter(new QName("", "", k), new XdmAtomicValue(v))}
+//            trans3.setParameter(new QName("", "", "doc_uri"), new XdmAtomicValue(spec))
+            (defaultParams ++ paramsNoURI + ( "doc_uri" -> spec )) foreach { case (k, v) => trans3.setParameter(new QName("", "", k), new XdmAtomicValue(v))}
             trans3.setDestination(out)
             trans3.transform()
 
@@ -179,28 +180,8 @@
       }
     }
 
-    /**
-     * https://cvs.w3.org/Team/WWW/2005/07/.htaccess
-     * https://cvs.w3.org/Team/WWW/2005/09/checker/pubrules-parser.php
-     * https://cvs.w3.org/Team/WWW/2005/09/checker/pubrules-form.php3
-     */
-    val redirects = unfiltered.filter.Planify {
-//      case Path("/2005/07/pubrules-checker") & QueryString(queryString) => Redirect("/2005/09/checker/pubrules-form"+queryString)
-        case Path("/2005/09/checker/pubrules-parser") & QueryString(queryString) & Params(params) => {
-          lazy val check = params("check").headOption
-          lazy val uri = params("uri").headOption
-          lazy val filter = params("filter").headOption
-          if (check.isDefined && uri.isDefined)
-            //Redirect("/2005/09/checker/pubrules-form?" + queryString)
-            Redirect("/2005/09/checker/pubrules-form-generic?" + queryString)
-          else if (filter.isDefined)
-            Redirect("http://www.w3.org/2005/07/pubrules?" + queryString + "#docreqs")
-          else
-            InternalServerError ~> ResponseString("You have reached this page due to an error...")
-        }
-    }
 
-    unfiltered.jetty.Http.local(2719).filter(pubrules).filter(trdoc2rdf).filter(echo).filter(redirects).run()
+    unfiltered.jetty.Http.local(2719).filter(pubrules).filter(trdoc2rdf).filter(echo).run()
 
 
   }
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.