Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Fixed up the mvc sample

  • Loading branch information...
commit 2569be1d3b2fc01b5a8f35201942b8acbbda394e 1 parent f57f5ca
Diego Medina fmpwizard authored
2  scala_29/lift_basic/build.sbt
View
@@ -19,7 +19,7 @@ libraryDependencies ++= {
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile",
- "net.liftmodules" %% "lift-jquery-module" % (liftVersion + "-0.0.4-SNAPSHOT"),
+ "net.liftmodules" %% "lift-jquery-module" % (liftVersion + "-1.0-SNAPSHOT"),
"org.eclipse.jetty" % "jetty-webapp" % "7.5.4.v20111024" % "container; test",
"ch.qos.logback" % "logback-classic" % "1.0.6",
"org.specs2" %% "specs2" % "1.11" % "test",
29 scala_29/lift_mvc/build.sbt
View
@@ -0,0 +1,29 @@
+name := "Lift 2.5 starter template"
+
+version := "0.0.1"
+
+organization := "net.liftweb"
+
+scalaVersion := "2.9.1"
+
+resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
+ "releases" at "http://oss.sonatype.org/content/repositories/releases"
+ )
+
+seq(com.github.siasia.WebPlugin.webSettings :_*)
+
+scalacOptions ++= Seq("-deprecation", "-unchecked")
+
+libraryDependencies ++= {
+ val liftVersion = "2.5-SNAPSHOT"
+ Seq(
+ "net.liftweb" %% "lift-webkit" % liftVersion % "compile",
+ "net.liftweb" %% "lift-mapper" % liftVersion % "compile",
+ "net.liftmodules" %% "lift-jquery-module" % (liftVersion + "-1.0-SNAPSHOT"),
+ "org.eclipse.jetty" % "jetty-webapp" % "7.5.4.v20111024" % "container; test",
+ "ch.qos.logback" % "logback-classic" % "1.0.6",
+ "org.specs2" %% "specs2" % "1.11" % "test",
+ "com.h2database" % "h2" % "1.3.167"
+ )
+}
+
9 scala_29/lift_mvc/project/build.properties
View
@@ -1,9 +0,0 @@
-#Project properties
-project.organization=Lift
-project.name=Lift SBT Template
-sbt.version=0.7.7
-project.version=0.1
-def.scala.version=2.7.7
-build.scala.versions=2.9.0-1
-project.initialize=false
-lift.version=2.4
26 scala_29/lift_mvc/project/build/LiftProject.scala
View
@@ -1,26 +0,0 @@
-import sbt._
-
-class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) {
- val liftVersion = property[Version]
-
- // uncomment the following if you want to use the snapshot repo
- // val scalatoolsSnapshot = ScalaToolsSnapshots
-
- // If you're using JRebel for Lift development, uncomment
- // this line
- // override def scanDirectories = Nil
-
- lazy val JavaNet = "Java.net Maven2 Repository" at "http://download.java.net/maven/2/"
-
- val SonatypeRep = "Sonatype scala-tools repo" at "https://oss.sonatype.org/content/groups/scala-tools/"
-
- override def libraryDependencies = Set(
- "net.liftweb" %% "lift-webkit" % liftVersion.value.toString % "compile",
- "net.liftweb" %% "lift-mapper" % liftVersion.value.toString % "compile",
- "org.mortbay.jetty" % "jetty" % "6.1.26" % "test",
- "junit" % "junit" % "4.7" % "test",
- "ch.qos.logback" % "logback-classic" % "0.9.26",
- "org.scala-tools.testing" %% "specs" % "1.6.8" % "test",
- "com.h2database" % "h2" % "1.2.147"
- ) ++ super.libraryDependencies
-}
12 scala_29/lift_mvc/project/plugins.sbt
View
@@ -0,0 +1,12 @@
+libraryDependencies <+= sbtVersion(v => v match {
+ case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
+ case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
+ case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11"
+ case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
+})
+
+//Uncoment this line to enable the sbt idea plugin
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")
+
+//Uncoment this line to enable the sbt eclipse plugin
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
2  scala_29/lift_mvc/sbt
View
@@ -1 +1 @@
-java -Xmx1024M -Xss2M -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launcher.jar "$@"
+java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launcher.jar "$@"
BIN  scala_29/lift_mvc/sbt-launcher.jar
View
Binary file not shown
23 scala_29/lift_mvc/src/main/resources/props/default.logback.xml
View
@@ -0,0 +1,23 @@
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>console.devmode.log</file>
+ <append>true</append>
+ <encoder>
+ <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+
+ <logger name="code.snippet" level="info" />
+ <logger name="net.liftweb" level="warn" />
+ <logger name="bootstrap.liftweb" level="info" />
+ <root level="warn">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
12 scala_29/lift_mvc/src/main/scala/bootstrap/liftweb/Boot.scala
View
@@ -8,6 +8,7 @@ import common._
import http._
import code.controller._
+import net.liftmodules.JQueryModule
/**
@@ -19,8 +20,7 @@ class Boot {
// where to search snippet
LiftRules.addToPackages("code")
- // Use jQuery 1.4
- LiftRules.jsArtifacts = net.liftweb.http.js.jquery.JQuery14Artifacts
+ LiftRules.jsArtifacts = net.liftweb.http.js.jquery.JQueryArtifacts
//Show the spinny image when an Ajax call starts
LiftRules.ajaxStart =
@@ -34,5 +34,13 @@ class Boot {
LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
LiftRules.dispatch.append(RootController)
+
+ // Use HTML5 for rendering
+ LiftRules.htmlProperties.default.set((r: Req) =>
+ new Html5Properties(r.userAgent))
+
+ //Init the jQuery module, see http://liftweb.net/jquery for more information.
+ JQueryModule.InitParam.JQuery=JQueryModule.JQuery172
+ JQueryModule.init()
}
}
25 scala_29/lift_mvc/src/main/webapp/templates-hidden/default.html
View
@@ -3,10 +3,11 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
- <lift:CSS.blueprint />
- <lift:CSS.fancyType />
- <script id="jquery" src="/classpath/jquery.js" type="text/javascript"/>
- <script id="json" src="/classpath/json.js" type="text/javascript"/>
+ <title class="lift:Menu.title">App: </title>
+ <style class="lift:CSS.blueprint"></style>
+ <style class="lift:CSS.fancyType"></style>
+ <script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
+ <script id="json" src="/classpath/json.js" type="text/javascript"></script>
<style type="text/css">
/* <![CDATA[ */
.edit_error_class {
@@ -54,20 +55,20 @@
<body>
<div class="container">
<div class="column span-12 last" style="text-align: right">
- <h1 class="alt">app<img alt="" id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"/></h1>
+ <h1 class="alt">app<img alt="" id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"></h1>
</div>
-
- <hr/>
-
- <div class="column span-23 last">
- <lift:bind name="content" />
+ <hr>
+ <div class="column span-6 colborder sidebar">
+ <hr class="space" />
+ </div>
+ <div class="column span-17 last">
+ <div id="content">The main content will get bound here</div>
</div>
-
<hr />
<div class="column span-23 last" style="text-align: center">
<h4 class="alt">
<a href="http://www.liftweb.net"><i>Lift</i></a>
- is Copyright 2007-2011 WorldWide Conferencing, LLC.
+ is Copyright 2007-2012 WorldWide Conferencing, LLC.
Distributed under an Apache 2.0 License.</h4>
</div>
</div>
23 scala_29/lift_mvc/src/test/resources/logback-test.xml
View
@@ -0,0 +1,23 @@
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>console.devmode.log</file>
+ <append>true</append>
+ <encoder>
+ <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+
+ <logger name="code.snippet" level="info" />
+ <logger name="net.liftweb" level="warn" />
+ <logger name="bootstrap.liftweb" level="info" />
+ <root level="warn">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
15 scala_29/lift_mvc/src/test/scala/LiftConsole.scala
View
@@ -1,15 +0,0 @@
-import bootstrap.liftweb.Boot
-import scala.tools.nsc.MainGenericRunner
-
-object LiftConsole {
- def main(args : Array[String]) {
- // Instantiate your project's Boot file
- val b = new Boot()
- // Boot your project
- b.boot
- // Now run the MainGenericRunner to get your repl
- MainGenericRunner.main(args)
- // After the repl exits, then exit the scala script
- sys.exit(0)
- }
-}
15 scala_29/lift_mvc/src/test/scala/RunWebApp.scala
View
@@ -1,7 +1,7 @@
-import org.mortbay.jetty.Connector
-import org.mortbay.jetty.Server
-import org.mortbay.jetty.webapp.WebAppContext
-import org.mortbay.jetty.nio._
+import org.eclipse.jetty.server.handler.ContextHandler
+import org.eclipse.jetty.server.nio.SelectChannelConnector
+import org.eclipse.jetty.server.{Handler, Server}
+import org.eclipse.jetty.webapp.WebAppContext
object RunWebApp extends App {
val server = new Server
@@ -11,10 +11,11 @@ object RunWebApp extends App {
val context = new WebAppContext()
context.setServer(server)
- context.setContextPath("/")
context.setWar("src/main/webapp")
- server.addHandler(context)
+ val context0: ContextHandler = new ContextHandler();
+ context0.setHandler(context)
+ server.setHandler(context0)
try {
println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP")
@@ -25,7 +26,7 @@ object RunWebApp extends App {
server.stop()
server.join()
} catch {
- case exc : Exception => {
+ case exc: Exception => {
exc.printStackTrace()
System.exit(100)
}
76 scala_29/lift_mvc/src/test/scala/code/AppTest.scala
View
@@ -1,76 +0,0 @@
-package code
-
-import java.io.File
-import junit.framework._
-import Assert._
-import scala.xml.XML
-import net.liftweb.util._
-import net.liftweb.common._
-
-object AppTest {
- def suite: Test = {
- val suite = new TestSuite(classOf[AppTest])
- suite
- }
-
- def main(args : Array[String]) {
- junit.textui.TestRunner.run(suite)
- }
-}
-
-/**
- * Unit test for simple App.
- */
-class AppTest extends TestCase("app") {
-
- /**
- * Rigourous Tests :-)
- */
- def testOK() = assertTrue(true)
- // def testKO() = assertTrue(false);
-
- /**
- * Tests to make sure the project's XML files are well-formed.
- *
- * Finds every *.html and *.xml file in src/main/webapp (and its
- * subdirectories) and tests to make sure they are well-formed.
- */
- def testXml() = {
- var failed: List[File] = Nil
-
- def handledXml(file: String) =
- file.endsWith(".xml")
-
- def handledXHtml(file: String) =
- file.endsWith(".html") || file.endsWith(".htm") || file.endsWith(".xhtml")
-
- def wellFormed(file: File) {
- if (file.isDirectory)
- for (f <- file.listFiles) wellFormed(f)
-
- if (file.isFile && handledXml(file.getName)) {
- try {
- XML.loadFile(file)
- } catch {
- case e: org.xml.sax.SAXParseException => failed = file :: failed
- }
- }
- if (file.isFile && handledXHtml(file.getName)) {
- PCDataXmlParser(new java.io.FileInputStream(file.getAbsolutePath)) match {
- case Full(_) => // file is ok
- case _ => failed = file :: failed
- }
- }
- }
-
- wellFormed(new File("src/main/webapp"))
-
- val numFails = failed.size
- if (numFails > 0) {
- val fileStr = if (numFails == 1) "file" else "files"
- val msg = "Malformed XML in " + numFails + " " + fileStr + ": " + failed.mkString(", ")
- println(msg)
- fail(msg)
- }
- }
-}
Please sign in to comment.
Something went wrong with that request. Please try again.