fix assembly config so that it the sbt "assembly" task works and produces a runnable jar which can be started with "java -Dnetty.ssl.keyStoreType=JKS -Dnetty.ssl.keyStore=`pwd`/src/test/resources/KEYSTORE.jks -Dnetty.ssl.keyStorePassword=secret -jar target/read-write-web.jar --https 8443 test_www /2011/09" webid
authorHenry Story <henry.story@bblfish.net>
Thu, 22 Dec 2011 02:28:07 +0100
branchwebid
changeset 160 7b456ecbce47
parent 159 55785ff6ed2f
child 161 af6187231494
fix assembly config so that it the sbt "assembly" task works and produces a runnable jar which can be started with "java -Dnetty.ssl.keyStoreType=JKS -Dnetty.ssl.keyStore=`pwd`/src/test/resources/KEYSTORE.jks -Dnetty.ssl.keyStorePassword=secret -jar target/read-write-web.jar --https 8443 test_www /2011/09"
project/build.scala
src/main/scala/auth/WebIDSrvc.scala
src/main/scala/auth/X509view.scala
--- a/project/build.scala	Wed Dec 21 23:06:27 2011 +0100
+++ b/project/build.scala	Thu Dec 22 02:28:07 2011 +0100
@@ -23,6 +23,8 @@
       </dependency>
     </dependencies>
   val slf4jSimple = "org.slf4j" % "slf4j-simple" % "1.6.4"
+  val slf4japi = "org.slf4j" % "slf4j-api" % "1.6.4"
+  val slf4jlog = "org.slf4j" % "slf4j-log4j12" % "1.6.4"
   val antiXML = "com.codecommit" %% "anti-xml" % "0.4-SNAPSHOT" % "test"
   val jena = "com.hp.hpl.jena" % "jena" % "2.6.4"
   val rdfa = "net.rootdev" % "java-rdfa" % "0.4.2-RC2"
@@ -68,6 +70,7 @@
   import ProguardPlugin._
   import sbtassembly.Plugin._
   import sbtassembly.Plugin.AssemblyKeys._
+
   
 
   def keepUnder(pakage:String):String = "-keep class %s.**" format pakage
@@ -98,6 +101,9 @@
       libraryDependencies += unfiltered_jetty,
       libraryDependencies += unfiltered_netty,
       libraryDependencies += slf4jSimple,
+      libraryDependencies += slf4japi,
+      libraryDependencies += slf4jlog,
+
       libraryDependencies += jena,
       libraryDependencies += arq,
       libraryDependencies += antiXML,
@@ -110,7 +116,8 @@
       libraryDependencies += rdfa,
       libraryDependencies += htmlparser,
 
-      jarName in assembly := "read-write-web.jar"
+      jarName in assembly := "read-write-web.jar",
+      mainClass in assembly := Some("org.w3.readwriteweb.netty.ReadWriteWebNetty")
     )
 
 
--- a/src/main/scala/auth/WebIDSrvc.scala	Wed Dec 21 23:06:27 2011 +0100
+++ b/src/main/scala/auth/WebIDSrvc.scala	Thu Dec 22 02:28:07 2011 +0100
@@ -70,17 +70,17 @@
   }
 
 
-  val fileDir: File = new File(this.getClass.getResource("/template/webidp/").toURI)
+  val fileDir ="/template/webidp/"
 
   /**
    * using three different templates uses up more memory for the moment, and could be more maintenance work
    * if all three templates require similar changes, but it makes it easier to visualise the result without
    * needing a web server. 
    */
-  lazy val errorPg: Elem = XML.loadFile(new File(fileDir, "WebIdService.badcert.html"))
-  lazy val authenticatedPg: Elem = XML.loadFile(new File(fileDir, "WebIdService.auth.html"))
-  lazy val aboutPg: Elem = XML.loadFile(new File(fileDir, "WebIdService.about.html"))
-  lazy val profilePg: Elem = XML.loadFile(new File(fileDir, "WebIdService.entry.html"))
+  lazy val errorPg: Elem = XML.load(this.getClass.getResourceAsStream(fileDir+ "WebIdService.badcert.html"))
+  lazy val authenticatedPg: Elem = XML.load(this.getClass.getResourceAsStream(fileDir+ "WebIdService.auth.html"))
+  lazy val aboutPg: Elem = XML.load(this.getClass.getResourceAsStream(fileDir+ "WebIdService.about.html"))
+  lazy val profilePg: Elem = XML.load(this.getClass.getResourceAsStream(fileDir+ "WebIdService.entry.html"))
 
   def intent : Cycle.Intent[Req,Res] = {
     case req @ Path(Seg("srv" :: "idp" :: next))  => { //easy partial function entry match
--- a/src/main/scala/auth/X509view.scala	Wed Dec 21 23:06:27 2011 +0100
+++ b/src/main/scala/auth/X509view.scala	Thu Dec 22 02:28:07 2011 +0100
@@ -49,14 +49,10 @@
 trait X509view[Req,Res]  {
    implicit def manif: Manifest[Req]
 
-  val fileDir: File = new File(this.getClass.getResource("/template/").toURI)
-  val templateDirs = List(fileDir)
-  implicit val engine = new TemplateEngine(templateDirs)
-  implicit val bindings: List[Binding] = List(Binding(name = "title", className = "String"))
-  implicit val additionalAttributes = List(("title", "My First Title"))
+  val fileDir = "/template/"
 
-  lazy val webidTst: Elem = XML.loadFile(new File(fileDir, "WebId.xhtml"))
-  lazy val noX509: Elem = XML.loadFile(new File(fileDir, "NoWebId.xhtml"))
+  lazy val webidTst: Elem = XML.load(this.getClass.getResourceAsStream(fileDir+"WebId.xhtml"))
+  lazy val noX509: Elem = XML.load(this.getClass.getResourceAsStream(fileDir+"NoWebId.xhtml"))
   
   def intent : Cycle.Intent[Req,Res] = {
     case req @ Path("/test/WebId")  => req match {