Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Copied scala_210 as scala_29 (next up: update the build.sbt)

  • Loading branch information...
commit 06c0c5a789e12ec2f26b5051cdea62cf69135879 1 parent 8bba148
@d6y d6y authored
Showing with 1,578 additions and 0 deletions.
  1. +23 −0 scala_29/README.md
  2. +33 −0 scala_29/lift_basic/build.sbt
  3. +2 −0  scala_29/lift_basic/project/build.properties
  4. +13 −0 scala_29/lift_basic/project/plugins.sbt
  5. +1 −0  scala_29/lift_basic/sbt
  6. BIN  scala_29/lift_basic/sbt-launch-0.12.1.jar
  7. +2 −0  scala_29/lift_basic/sbt.bat
  8. 0  scala_29/lift_basic/src/main/resources/.keep
  9. +23 −0 scala_29/lift_basic/src/main/resources/logback.xml
  10. 0  scala_29/lift_basic/src/main/resources/props/default.props
  11. +85 −0 scala_29/lift_basic/src/main/scala/bootstrap/liftweb/Boot.scala
  12. 0  scala_29/lift_basic/src/main/scala/code/comet/.keep
  13. +55 −0 scala_29/lift_basic/src/main/scala/code/lib/DependencyFactory.scala
  14. +36 −0 scala_29/lift_basic/src/main/scala/code/model/User.scala
  15. +23 −0 scala_29/lift_basic/src/main/scala/code/snippet/HelloWorld.scala
  16. 0  scala_29/lift_basic/src/main/scala/code/view/.keep
  17. +21 −0 scala_29/lift_basic/src/main/webapp/WEB-INF/web.xml
  18. BIN  scala_29/lift_basic/src/main/webapp/images/ajax-loader.gif
  19. +18 −0 scala_29/lift_basic/src/main/webapp/index.html
  20. +5 −0 scala_29/lift_basic/src/main/webapp/static/index.html
  21. +85 −0 scala_29/lift_basic/src/main/webapp/templates-hidden/default.html
  22. +57 −0 scala_29/lift_basic/src/main/webapp/templates-hidden/wizard-all.html
  23. 0  scala_29/lift_basic/src/test/resources/.keep
  24. +23 −0 scala_29/lift_basic/src/test/resources/logback-test.xml
  25. +34 −0 scala_29/lift_basic/src/test/scala/RunWebApp.scala
  26. +42 −0 scala_29/lift_basic/src/test/scala/code/snippet/HelloWorldTest.scala
  27. +30 −0 scala_29/lift_blank/build.sbt
  28. +2 −0  scala_29/lift_blank/project/build.properties
  29. +13 −0 scala_29/lift_blank/project/plugins.sbt
  30. +1 −0  scala_29/lift_blank/sbt
  31. BIN  scala_29/lift_blank/sbt-launch-0.12.1.jar
  32. +2 −0  scala_29/lift_blank/sbt.bat
  33. 0  scala_29/lift_blank/src/main/resources/.keep
  34. +23 −0 scala_29/lift_blank/src/main/resources/logback.xml
  35. 0  scala_29/lift_blank/src/main/resources/props/default.props
  36. +58 −0 scala_29/lift_blank/src/main/scala/bootstrap/liftweb/Boot.scala
  37. 0  scala_29/lift_blank/src/main/scala/code/comet/.keep
  38. +55 −0 scala_29/lift_blank/src/main/scala/code/lib/DependencyFactory.scala
  39. 0  scala_29/lift_blank/src/main/scala/code/model/.keep
  40. +23 −0 scala_29/lift_blank/src/main/scala/code/snippet/HelloWorld.scala
  41. 0  scala_29/lift_blank/src/main/scala/code/view/.keep
  42. +21 −0 scala_29/lift_blank/src/main/webapp/WEB-INF/web.xml
  43. BIN  scala_29/lift_blank/src/main/webapp/images/ajax-loader.gif
  44. +15 −0 scala_29/lift_blank/src/main/webapp/index.html
  45. +11 −0 scala_29/lift_blank/src/main/webapp/static/index.html
  46. +85 −0 scala_29/lift_blank/src/main/webapp/templates-hidden/default.html
  47. +23 −0 scala_29/lift_blank/src/main/webapp/templates-hidden/wizard-all.html
  48. 0  scala_29/lift_blank/src/test/resources/.keep
  49. +23 −0 scala_29/lift_blank/src/test/resources/logback-test.xml
  50. +34 −0 scala_29/lift_blank/src/test/scala/RunWebApp.scala
  51. +42 −0 scala_29/lift_blank/src/test/scala/code/snippet/HelloWorldTest.scala
  52. +23 −0 scala_29/lift_json/build.sbt
  53. +2 −0  scala_29/lift_json/project/build.properties
  54. +13 −0 scala_29/lift_json/project/plugins.sbt
  55. +1 −0  scala_29/lift_json/sbt
  56. BIN  scala_29/lift_json/sbt-launch-0.12.1.jar
  57. +2 −0  scala_29/lift_json/sbt.bat
  58. +23 −0 scala_29/lift_json/src/test/resources/logback-test.xml
  59. +28 −0 scala_29/lift_json/src/test/scala/code/json/JsonSpecs.scala
  60. +32 −0 scala_29/lift_mvc/build.sbt
  61. +2 −0  scala_29/lift_mvc/project/build.properties
  62. +13 −0 scala_29/lift_mvc/project/plugins.sbt
  63. +1 −0  scala_29/lift_mvc/sbt
  64. BIN  scala_29/lift_mvc/sbt-launch-0.12.1.jar
  65. +2 −0  scala_29/lift_mvc/sbt.bat
  66. 0  scala_29/lift_mvc/src/main/resources/.keep
  67. +23 −0 scala_29/lift_mvc/src/main/resources/logback.xml
  68. 0  scala_29/lift_mvc/src/main/resources/props/default.props
  69. +46 −0 scala_29/lift_mvc/src/main/scala/bootstrap/liftweb/Boot.scala
  70. 0  scala_29/lift_mvc/src/main/scala/code/comet/.keep
  71. +31 −0 scala_29/lift_mvc/src/main/scala/code/controller/RootController.scala
  72. +55 −0 scala_29/lift_mvc/src/main/scala/code/lib/DependencyFactory.scala
  73. 0  scala_29/lift_mvc/src/main/scala/code/model/.keep
  74. 0  scala_29/lift_mvc/src/main/scala/code/snippet/.keep
  75. 0  scala_29/lift_mvc/src/main/scala/code/view/.keep
  76. +21 −0 scala_29/lift_mvc/src/main/webapp/WEB-INF/web.xml
  77. BIN  scala_29/lift_mvc/src/main/webapp/images/ajax-loader.gif
  78. +36 −0 scala_29/lift_mvc/src/main/webapp/index.html
  79. +26 −0 scala_29/lift_mvc/src/main/webapp/show_int.html
  80. +76 −0 scala_29/lift_mvc/src/main/webapp/templates-hidden/default.html
  81. +23 −0 scala_29/lift_mvc/src/main/webapp/templates-hidden/wizard-all.html
  82. 0  scala_29/lift_mvc/src/test/resources/.keep
  83. +23 −0 scala_29/lift_mvc/src/test/resources/logback-test.xml
  84. +34 −0 scala_29/lift_mvc/src/test/scala/RunWebApp.scala
View
23 scala_29/README.md
@@ -0,0 +1,23 @@
+#This folder contains multiple Lift project templates:
+
+- lift_basic is a basic Lift application with a built-in user class
+ and nice use of Blueprint CSS and HTML5
+
+
+- lift_blank is a blank Lift project that does not have any model
+ or CSS
+
+- lift_mvc is a Lift project that uses Lift's MVC support rather
+ than view-first. No model stuff, but Blueprint CSS
+
+- lift_json is a Lift project that uses Lift's json library in a specs2 test class
+ to demonstrate extractions based on case classes.
+
+
+##All projects features:
+
+1. specs2
+2. logback
+3. log back sample xml configuration file (for both, runtime and test)
+4. jetty 8.1
+5. lift-jquery-module module to bring the latest jQuery plugin
View
33 scala_29/lift_basic/build.sbt
@@ -0,0 +1,33 @@
+name := "Lift 2.5 starter template"
+
+version := "0.0.1"
+
+organization := "net.liftweb"
+
+scalaVersion := "2.10.0"
+
+resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
+ "staging" at "http://oss.sonatype.org/content/repositories/staging",
+ "releases" at "http://oss.sonatype.org/content/repositories/releases"
+ )
+
+seq(com.github.siasia.WebPlugin.webSettings :_*)
+
+unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }
+
+scalacOptions ++= Seq("-deprecation", "-unchecked")
+
+libraryDependencies ++= {
+ val liftVersion = "2.5"
+ Seq(
+ "net.liftweb" %% "lift-webkit" % liftVersion % "compile",
+ "net.liftweb" %% "lift-mapper" % liftVersion % "compile",
+ "net.liftmodules" %% "lift-jquery-module_2.5" % "2.3",
+ "org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container,test",
+ "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
+ "ch.qos.logback" % "logback-classic" % "1.0.6",
+ "org.specs2" %% "specs2" % "1.14" % "test",
+ "com.h2database" % "h2" % "1.3.167"
+ )
+}
+
View
2  scala_29/lift_basic/project/build.properties
@@ -0,0 +1,2 @@
+sbt.version=0.12.2
+
View
13 scala_29/lift_basic/project/plugins.sbt
@@ -0,0 +1,13 @@
+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.10"
+ case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
+ case x if x startsWith "0.12" => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
+})
+
+//Enable the sbt idea plugin
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0")
+
+//Enable the sbt eclipse plugin
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.2")
View
1  scala_29/lift_basic/sbt
@@ -0,0 +1 @@
+java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launch-0.12.1.jar "$@"
View
BIN  scala_29/lift_basic/sbt-launch-0.12.1.jar
Binary file not shown
View
2  scala_29/lift_basic/sbt.bat
@@ -0,0 +1,2 @@
+set SCRIPT_DIR=%~dp0
+java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx1024M -Xss2M -jar "%SCRIPT_DIR%\sbt-launch-0.12.1.jar" %*
View
0  scala_29/lift_basic/src/main/resources/.keep
No changes.
View
23 scala_29/lift_basic/src/main/resources/logback.xml
@@ -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>
View
0  scala_29/lift_basic/src/main/resources/props/default.props
No changes.
View
85 scala_29/lift_basic/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -0,0 +1,85 @@
+package bootstrap.liftweb
+
+import net.liftweb._
+import util._
+import Helpers._
+
+import common._
+import http._
+import js.jquery.JQueryArtifacts
+import sitemap._
+import Loc._
+import mapper._
+
+import code.model._
+import net.liftmodules.JQueryModule
+
+
+/**
+ * A class that's instantiated early and run. It allows the application
+ * to modify lift's environment
+ */
+class Boot {
+ def boot {
+ if (!DB.jndiJdbcConnAvailable_?) {
+ val vendor =
+ new StandardDBVendor(Props.get("db.driver") openOr "org.h2.Driver",
+ Props.get("db.url") openOr
+ "jdbc:h2:lift_proto.db;AUTO_SERVER=TRUE",
+ Props.get("db.user"), Props.get("db.password"))
+
+ LiftRules.unloadHooks.append(vendor.closeAllConnections_! _)
+
+ DB.defineConnectionManager(DefaultConnectionIdentifier, vendor)
+ }
+
+ // Use Lift's Mapper ORM to populate the database
+ // you don't need to use Mapper to use Lift... use
+ // any ORM you want
+ Schemifier.schemify(true, Schemifier.infoF _, User)
+
+ // where to search snippet
+ LiftRules.addToPackages("code")
+
+ // Build SiteMap
+ def sitemap = SiteMap(
+ Menu.i("Home") / "index" >> User.AddUserMenusAfter, // the simple way to declare a menu
+
+ // more complex because this menu allows anything in the
+ // /static path to be visible
+ Menu(Loc("Static", Link(List("static"), true, "/static/index"),
+ "Static Content")))
+
+ def sitemapMutators = User.sitemapMutator
+
+ // set the sitemap. Note if you don't want access control for
+ // each page, just comment this line out.
+ LiftRules.setSiteMapFunc(() => sitemapMutators(sitemap))
+
+ //Init the jQuery module, see http://liftweb.net/jquery for more information.
+ LiftRules.jsArtifacts = JQueryArtifacts
+ JQueryModule.InitParam.JQuery=JQueryModule.JQuery172
+ JQueryModule.init()
+
+ //Show the spinny image when an Ajax call starts
+ LiftRules.ajaxStart =
+ Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
+
+ // Make the spinny image go away when it ends
+ LiftRules.ajaxEnd =
+ Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
+
+ // Force the request to be UTF-8
+ LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
+
+ // What is the function to test if a user is logged in?
+ LiftRules.loggedInTest = Full(() => User.loggedIn_?)
+
+ // Use HTML5 for rendering
+ LiftRules.htmlProperties.default.set((r: Req) =>
+ new Html5Properties(r.userAgent))
+
+ // Make a transaction span the whole HTTP request
+ S.addAround(DB.buildLoanWrapper)
+ }
+}
View
0  scala_29/lift_basic/src/main/scala/code/comet/.keep
No changes.
View
55 scala_29/lift_basic/src/main/scala/code/lib/DependencyFactory.scala
@@ -0,0 +1,55 @@
+package code
+package lib
+
+import net.liftweb._
+import http._
+import util._
+import common._
+import java.util.Date
+
+/**
+ * A factory for generating new instances of Date. You can create
+ * factories for each kind of thing you want to vend in your application.
+ * An example is a payment gateway. You can change the default implementation,
+ * or override the default implementation on a session, request or current call
+ * stack basis.
+ */
+object DependencyFactory extends Factory {
+ implicit object time extends FactoryMaker(Helpers.now _)
+
+ /**
+ * objects in Scala are lazily created. The init()
+ * method creates a List of all the objects. This
+ * results in all the objects getting initialized and
+ * registering their types with the dependency injector
+ */
+ private def init() {
+ List(time)
+ }
+ init()
+}
+
+/*
+/**
+ * Examples of changing the implementation
+ */
+sealed abstract class Changer {
+ def changeDefaultImplementation() {
+ DependencyFactory.time.default.set(() => new Date())
+ }
+
+ def changeSessionImplementation() {
+ DependencyFactory.time.session.set(() => new Date())
+ }
+
+ def changeRequestImplementation() {
+ DependencyFactory.time.request.set(() => new Date())
+ }
+
+ def changeJustForCall(d: Date) {
+ DependencyFactory.time.doWith(d) {
+ // perform some calculations here
+ }
+ }
+}
+*/
View
36 scala_29/lift_basic/src/main/scala/code/model/User.scala
@@ -0,0 +1,36 @@
+package code
+package model
+
+import net.liftweb.mapper._
+import net.liftweb.util._
+import net.liftweb.common._
+
+/**
+ * The singleton that has methods for accessing the database
+ */
+object User extends User with MetaMegaProtoUser[User] {
+ override def dbTableName = "users" // define the DB table name
+ override def screenWrap = Full(<lift:surround with="default" at="content">
+ <lift:bind /></lift:surround>)
+ // define the order fields will appear in forms and output
+ override def fieldOrder = List(id, firstName, lastName, email,
+ locale, timezone, password, textArea)
+
+ // comment this line out to require email validations
+ override def skipEmailValidation = true
+}
+
+/**
+ * An O-R mapped "User" class that includes first name, last name, password and we add a "Personal Essay" to it
+ */
+class User extends MegaProtoUser[User] {
+ def getSingleton = User // what's the "meta" server
+
+ // define an additional field for a personal essay
+ object textArea extends MappedTextarea(this, 2048) {
+ override def textareaRows = 10
+ override def textareaCols = 50
+ override def displayName = "Personal Essay"
+ }
+}
+
View
23 scala_29/lift_basic/src/main/scala/code/snippet/HelloWorld.scala
@@ -0,0 +1,23 @@
+package code
+package snippet
+
+import scala.xml.{NodeSeq, Text}
+import net.liftweb.util._
+import net.liftweb.common._
+import java.util.Date
+import code.lib._
+import Helpers._
+
+class HelloWorld {
+ lazy val date: Box[Date] = DependencyFactory.inject[Date] // inject the date
+
+ // replace the contents of the element with id "time" with the date
+ def howdy = "#time *" #> date.map(_.toString)
+
+ /*
+ lazy val date: Date = DependencyFactory.time.vend // create the date via factory
+
+ def howdy = "#time *" #> date.toString
+ */
+}
+
View
0  scala_29/lift_basic/src/main/scala/code/view/.keep
No changes.
View
21 scala_29/lift_basic/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+"http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+<filter>
+ <filter-name>LiftFilter</filter-name>
+ <display-name>Lift Filter</display-name>
+ <description>The Filter that intercepts lift calls</description>
+ <filter-class>net.liftweb.http.LiftFilter</filter-class>
+</filter>
+
+
+<filter-mapping>
+ <filter-name>LiftFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+</filter-mapping>
+
+</web-app>
View
BIN  scala_29/lift_basic/src/main/webapp/images/ajax-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
18 scala_29/lift_basic/src/main/webapp/index.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
+ <title>Home</title>
+ </head>
+ <body class="lift:content_id=main">
+ <div id="main" class="lift:surround?with=default;at=content">
+ <h2>Welcome to your project!</h2>
+ <p>
+ <span class="lift:helloWorld.howdy">
+ Welcome to your Lift app at <span id="time">Time goes here</span>
+ </span>
+ </p>
+ </div>
+ </body>
+</html>
+
View
5 scala_29/lift_basic/src/main/webapp/static/index.html
@@ -0,0 +1,5 @@
+<div id="main" class="lift:surround?with=default;at=content">
+ Static content... everything you put in the /static
+ directory will be served without additions to SiteMap
+</div>
+
View
85 scala_29/lift_basic/src/main/webapp/templates-hidden/default.html
@@ -0,0 +1,85 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:lift="http://liftweb.net/">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <meta name="description" content="" />
+ <meta name="keywords" content="" />
+ <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 {
+ display: block;
+ color: red;
+}
+
+.sidebar ul {
+ margin:0;
+ padding:0;
+ border-bottom:1px solid #ccc;
+}
+
+
+.sidebar ul li {
+ margin:0;
+ padding:0;
+ list-style:none;
+ border:1px solid #ccc;
+ border-bottom:none;
+}
+
+.sidebar ul li a {
+ display:block;
+ padding:3px;
+ text-indent:30px;
+ text-decoration:none;
+}
+
+.sidebar ul li span {
+ display:block;
+ padding:3px;
+ text-indent:30px;
+ text-decoration:none;
+}
+
+.sidebar ul li a:hover {
+ background-color: #eee;
+}
+
+
+ /* ]]> */
+ </style>
+ </head>
+ <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>
+ </div>
+
+ <hr>
+
+ <div class="column span-6 colborder sidebar">
+ <hr class="space" >
+
+ <span class="lift:Menu.builder"></span>
+
+ <div class="lift:Msgs?showAll=true"></div>
+ <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-2012 WorldWide Conferencing, LLC.
+ Distributed under an Apache 2.0 License.</h4>
+ </div>
+ </div>
+ </body>
+</html>
View
57 scala_29/lift_basic/src/main/webapp/templates-hidden/wizard-all.html
@@ -0,0 +1,57 @@
+<div>
+ <wizard:screen_info><div>Page <wizard:screen_number></wizard:screen_number> of <wizard:total_screens></wizard:total_screens></div></wizard:screen_info>
+ <wizard:wizard_top> <div> <wizard:bind></wizard:bind> </div> </wizard:wizard_top>
+ <wizard:screen_top> <div> <wizard:bind></wizard:bind> </div> </wizard:screen_top>
+ <wizard:errors> <div> <ul> <wizard:item> <li> <wizard:bind></wizard:bind> </li> </wizard:item> </ul> </div> </wizard:errors>
+ <div>
+ <wizard:fields>
+ <table>
+ <tbody>
+ <tr lift:bind="wizard:line">
+ <td>
+ <wizard:label>
+ <label wizard:for="">
+ <wizard:bind></wizard:bind>
+ </label>
+ </wizard:label>
+ <wizard:help>
+ <span>
+ <wizard:bind></wizard:bind>
+ </span>
+ </wizard:help>
+ <wizard:field_errors>
+ <ul>
+ <wizard:error>
+ <li>
+ <wizard:bind></wizard:bind>
+ </li>
+ </wizard:error>
+ </ul>
+ </wizard:field_errors>
+ </td>
+ <td>
+ <wizard:form></wizard:form>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </wizard:fields>
+ </div>
+ <div>
+ <table>
+ <tr>
+ <td>
+ <wizard:prev></wizard:prev>
+ </td>
+ <td>
+ <wizard:cancel></wizard:cancel>
+ </td>
+ <td>
+ <wizard:next></wizard:next>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <wizard:screen_bottom> <div> <wizard:bind></wizard:bind> </div> </wizard:screen_bottom>
+ <wizard:wizard_bottom> <div> <wizard:bind></wizard:bind> </div> </wizard:wizard_bottom>
+</div>
View
0  scala_29/lift_basic/src/test/resources/.keep
No changes.
View
23 scala_29/lift_basic/src/test/resources/logback-test.xml
@@ -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>
View
34 scala_29/lift_basic/src/test/scala/RunWebApp.scala
@@ -0,0 +1,34 @@
+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
+ val scc = new SelectChannelConnector
+ scc.setPort(8080)
+ server.setConnectors(Array(scc))
+
+ val context = new WebAppContext()
+ context.setServer(server)
+ context.setWar("src/main/webapp")
+
+ val context0: ContextHandler = new ContextHandler();
+ context0.setHandler(context)
+ server.setHandler(context0)
+
+ try {
+ println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP")
+ server.start()
+ while (System.in.available() == 0) {
+ Thread.sleep(5000)
+ }
+ server.stop()
+ server.join()
+ } catch {
+ case exc: Exception => {
+ exc.printStackTrace()
+ System.exit(100)
+ }
+ }
+}
View
42 scala_29/lift_basic/src/test/scala/code/snippet/HelloWorldTest.scala
@@ -0,0 +1,42 @@
+package code
+package snippet
+
+import net.liftweb._
+import http._
+import net.liftweb.util._
+import net.liftweb.common._
+import Helpers._
+import lib._
+import org.specs2.mutable.Specification
+import org.specs2.specification.AroundExample
+import org.specs2.execute.AsResult
+
+
+object HelloWorldTestSpecs extends Specification with AroundExample{
+ val session = new LiftSession("", randomString(20), Empty)
+ val stableTime = now
+
+ /**
+ * For additional ways of writing tests,
+ * please see http://www.assembla.com/spaces/liftweb/wiki/Mocking_HTTP_Requests
+ */
+ def around[T : AsResult](body: =>T) = {
+ S.initIfUninitted(session) {
+ DependencyFactory.time.doWith(stableTime) {
+ AsResult( body) // execute t inside a http session
+ }
+ }
+ }
+
+ "HelloWorld Snippet" should {
+ "Put the time in the node" in {
+ val hello = new HelloWorld
+ Thread.sleep(1000) // make sure the time changes
+
+ val str = hello.howdy(<span>Welcome to your Lift app at <span id="time">Time goes here</span></span>).toString
+
+ str.indexOf(stableTime.toString) must be >= 0
+ str must startWith("<span>Welcome to")
+ }
+ }
+}
View
30 scala_29/lift_blank/build.sbt
@@ -0,0 +1,30 @@
+name := "Lift 2.5 starter template"
+
+version := "0.0.1"
+
+organization := "net.liftweb"
+
+scalaVersion := "2.10.0"
+
+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 :_*)
+
+unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }
+
+scalacOptions ++= Seq("-deprecation", "-unchecked")
+
+libraryDependencies ++= {
+ val liftVersion = "2.5"
+ Seq(
+ "net.liftweb" %% "lift-webkit" % liftVersion % "compile",
+ "net.liftmodules" %% "lift-jquery-module_2.5" % "2.3",
+ "org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container,test",
+ "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
+ "ch.qos.logback" % "logback-classic" % "1.0.6",
+ "org.specs2" %% "specs2" % "1.14" % "test"
+ )
+}
+
View
2  scala_29/lift_blank/project/build.properties
@@ -0,0 +1,2 @@
+sbt.version=0.12.2
+
View
13 scala_29/lift_blank/project/plugins.sbt
@@ -0,0 +1,13 @@
+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.10"
+ case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
+ case x if x startsWith "0.12" => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
+})
+
+//Enable the sbt idea plugin
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0")
+
+//Enable the sbt eclipse plugin
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.2")
View
1  scala_29/lift_blank/sbt
@@ -0,0 +1 @@
+java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launch-0.12.1.jar "$@"
View
BIN  scala_29/lift_blank/sbt-launch-0.12.1.jar
Binary file not shown
View
2  scala_29/lift_blank/sbt.bat
@@ -0,0 +1,2 @@
+set SCRIPT_DIR=%~dp0
+java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx1024M -Xss2M -jar "%SCRIPT_DIR%\sbt-launch-0.12.1.jar" %*
View
0  scala_29/lift_blank/src/main/resources/.keep
No changes.
View
23 scala_29/lift_blank/src/main/resources/logback.xml
@@ -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>
View
0  scala_29/lift_blank/src/main/resources/props/default.props
No changes.
View
58 scala_29/lift_blank/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -0,0 +1,58 @@
+package bootstrap.liftweb
+
+import net.liftweb._
+import util._
+import Helpers._
+
+import common._
+import http._
+import sitemap._
+import Loc._
+import net.liftmodules.JQueryModule
+import net.liftweb.http.js.jquery._
+
+
+/**
+ * A class that's instantiated early and run. It allows the application
+ * to modify lift's environment
+ */
+class Boot {
+ def boot {
+ // where to search snippet
+ LiftRules.addToPackages("code")
+
+ // Build SiteMap
+ val entries = List(
+ Menu.i("Home") / "index", // the simple way to declare a menu
+
+ // more complex because this menu allows anything in the
+ // /static path to be visible
+ Menu(Loc("Static", Link(List("static"), true, "/static/index"),
+ "Static Content")))
+
+ // set the sitemap. Note if you don't want access control for
+ // each page, just comment this line out.
+ LiftRules.setSiteMap(SiteMap(entries:_*))
+
+ //Show the spinny image when an Ajax call starts
+ LiftRules.ajaxStart =
+ Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
+
+ // Make the spinny image go away when it ends
+ LiftRules.ajaxEnd =
+ Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
+
+ // Force the request to be UTF-8
+ LiftRules.early.append(_.setCharacterEncoding("UTF-8"))
+
+ // 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.
+ LiftRules.jsArtifacts = JQueryArtifacts
+ JQueryModule.InitParam.JQuery=JQueryModule.JQuery172
+ JQueryModule.init()
+
+ }
+}
View
0  scala_29/lift_blank/src/main/scala/code/comet/.keep
No changes.
View
55 scala_29/lift_blank/src/main/scala/code/lib/DependencyFactory.scala
@@ -0,0 +1,55 @@
+package code
+package lib
+
+import net.liftweb._
+import http._
+import util._
+import common._
+import java.util.Date
+
+/**
+ * A factory for generating new instances of Date. You can create
+ * factories for each kind of thing you want to vend in your application.
+ * An example is a payment gateway. You can change the default implementation,
+ * or override the default implementation on a session, request or current call
+ * stack basis.
+ */
+object DependencyFactory extends Factory {
+ implicit object time extends FactoryMaker(Helpers.now _)
+
+ /**
+ * objects in Scala are lazily created. The init()
+ * method creates a List of all the objects. This
+ * results in all the objects getting initialized and
+ * registering their types with the dependency injector
+ */
+ private def init() {
+ List(time)
+ }
+ init()
+}
+
+/*
+/**
+ * Examples of changing the implementation
+ */
+sealed abstract class Changer {
+ def changeDefaultImplementation() {
+ DependencyFactory.time.default.set(() => new Date())
+ }
+
+ def changeSessionImplementation() {
+ DependencyFactory.time.session.set(() => new Date())
+ }
+
+ def changeRequestImplementation() {
+ DependencyFactory.time.request.set(() => new Date())
+ }
+
+ def changeJustForCall(d: Date) {
+ DependencyFactory.time.doWith(d) {
+ // perform some calculations here
+ }
+ }
+}
+*/
View
0  scala_29/lift_blank/src/main/scala/code/model/.keep
No changes.
View
23 scala_29/lift_blank/src/main/scala/code/snippet/HelloWorld.scala
@@ -0,0 +1,23 @@
+package code
+package snippet
+
+import scala.xml.{NodeSeq, Text}
+import net.liftweb.util._
+import net.liftweb.common._
+import java.util.Date
+import code.lib._
+import Helpers._
+
+class HelloWorld {
+ lazy val date: Box[Date] = DependencyFactory.inject[Date] // inject the date
+
+ // replace the contents of the element with id "time" with the date
+ def howdy = "#time *" #> date.map(_.toString)
+
+ /*
+ lazy val date: Date = DependencyFactory.time.vend // create the date via factory
+
+ def howdy = "#time *" #> date.toString
+ */
+}
+
View
0  scala_29/lift_blank/src/main/scala/code/view/.keep
No changes.
View
21 scala_29/lift_blank/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+"http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+<filter>
+ <filter-name>LiftFilter</filter-name>
+ <display-name>Lift Filter</display-name>
+ <description>The Filter that intercepts lift calls</description>
+ <filter-class>net.liftweb.http.LiftFilter</filter-class>
+</filter>
+
+
+<filter-mapping>
+ <filter-name>LiftFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+</filter-mapping>
+
+</web-app>
View
BIN  scala_29/lift_blank/src/main/webapp/images/ajax-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
15 scala_29/lift_blank/src/main/webapp/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><title>Home</title></head>
+ <body class="lift:content_id=main">
+ <div id="main" class="lift:surround?with=default;at=content">
+ <h2>Welcome to your project!</h2>
+ <p>
+ <span class="lift:helloWorld.howdy">
+ Welcome to your Lift app at <span id="time">Time goes here</span>
+ </span>
+ </p>
+ </div>
+ </body>
+</html>
+
View
11 scala_29/lift_blank/src/main/webapp/static/index.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><title>Home</title></head>
+ <body class="lift:content_id=main">
+ <div id="main" class="lift:surround?with=default;at=content">
+ Static content... everything you put in the /static
+ directory will be served without additions to SiteMap
+ </div>
+ </body>
+</html>
+
View
85 scala_29/lift_blank/src/main/webapp/templates-hidden/default.html
@@ -0,0 +1,85 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:lift="http://liftweb.net/">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <meta name="description" content="" />
+ <meta name="keywords" content="" />
+ <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 {
+ display: block;
+ color: red;
+}
+
+.sidebar ul {
+ margin:0;
+ padding:0;
+ border-bottom:1px solid #ccc;
+}
+
+
+.sidebar ul li {
+ margin:0;
+ padding:0;
+ list-style:none;
+ border:1px solid #ccc;
+ border-bottom:none;
+}
+
+.sidebar ul li a {
+ display:block;
+ padding:3px;
+ text-indent:30px;
+ text-decoration:none;
+}
+
+.sidebar ul li span {
+ display:block;
+ padding:3px;
+ text-indent:30px;
+ text-decoration:none;
+}
+
+.sidebar ul li a:hover {
+ background-color: #eee;
+}
+
+
+ /* ]]> */
+ </style>
+ </head>
+ <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>
+ </div>
+
+ <hr>
+
+ <div class="column span-6 colborder sidebar">
+ <hr class="space" >
+
+ <span class="lift:Menu.builder"></span>
+
+ <div class="lift:Msgs?showAll=true"></div>
+ <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-2012 WorldWide Conferencing, LLC.
+ Distributed under an Apache 2.0 License.</h4>
+ </div>
+ </div>
+ </body>
+</html>
View
23 scala_29/lift_blank/src/main/webapp/templates-hidden/wizard-all.html
@@ -0,0 +1,23 @@
+<div>
+ <wizard:screen_info><div>Page <wizard:screen_number/> of <wizard:total_screens/></div></wizard:screen_info>
+ <wizard:wizard_top> <div> <wizard:bind/> </div> </wizard:wizard_top>
+ <wizard:screen_top> <div> <wizard:bind/> </div> </wizard:screen_top>
+ <wizard:errors> <div> <ul> <wizard:item> <li> <wizard:bind/> </li> </wizard:item> </ul> </div> </wizard:errors>
+ <div> <wizard:fields>
+ <table>
+ <wizard:line>
+ <tr>
+ <td>
+ <wizard:label><label wizard:for=""><wizard:bind/></label></wizard:label>
+ <wizard:help><span><wizard:bind/></span></wizard:help>
+ <wizard:field_errors> <ul> <wizard:error> <li> <wizard:bind/> </li> </wizard:error> </ul> </wizard:field_errors>
+ </td>
+ <td> <wizard:form/> </td>
+ </tr>
+ </wizard:line>
+ </table>
+ </wizard:fields> </div>
+ <div> <table> <tr> <td> <wizard:prev/> </td> <td> <wizard:cancel/> </td> <td> <wizard:next/> </td> </tr> </table> </div>
+ <wizard:screen_bottom> <div> <wizard:bind/> </div> </wizard:screen_bottom>
+ <wizard:wizard_bottom> <div> <wizard:bind/> </div> </wizard:wizard_bottom>
+</div>
View
0  scala_29/lift_blank/src/test/resources/.keep
No changes.
View
23 scala_29/lift_blank/src/test/resources/logback-test.xml
@@ -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>
View
34 scala_29/lift_blank/src/test/scala/RunWebApp.scala
@@ -0,0 +1,34 @@
+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
+ val scc = new SelectChannelConnector
+ scc.setPort(8080)
+ server.setConnectors(Array(scc))
+
+ val context = new WebAppContext()
+ context.setServer(server)
+ context.setWar("src/main/webapp")
+
+ val context0: ContextHandler = new ContextHandler();
+ context0.setHandler(context)
+ server.setHandler(context0)
+
+ try {
+ println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP")
+ server.start()
+ while (System.in.available() == 0) {
+ Thread.sleep(5000)
+ }
+ server.stop()
+ server.join()
+ } catch {
+ case exc: Exception => {
+ exc.printStackTrace()
+ System.exit(100)
+ }
+ }
+}
View
42 scala_29/lift_blank/src/test/scala/code/snippet/HelloWorldTest.scala
@@ -0,0 +1,42 @@
+package code
+package snippet
+
+import net.liftweb._
+import http._
+import net.liftweb.util._
+import net.liftweb.common._
+import Helpers._
+import lib._
+import org.specs2.mutable.Specification
+import org.specs2.specification.AroundExample
+import org.specs2.execute.AsResult
+
+
+object HelloWorldTestSpecs extends Specification with AroundExample{
+ val session = new LiftSession("", randomString(20), Empty)
+ val stableTime = now
+
+ /**
+ * For additional ways of writing tests,
+ * please see http://www.assembla.com/spaces/liftweb/wiki/Mocking_HTTP_Requests
+ */
+ def around[T : AsResult](body: =>T) = {
+ S.initIfUninitted(session) {
+ DependencyFactory.time.doWith(stableTime) {
+ AsResult( body) // execute t inside a http session
+ }
+ }
+ }
+
+ "HelloWorld Snippet" should {
+ "Put the time in the node" in {
+ val hello = new HelloWorld
+ Thread.sleep(1000) // make sure the time changes
+
+ val str = hello.howdy(<span>Welcome to your Lift app at <span id="time">Time goes here</span></span>).toString
+
+ str.indexOf(stableTime.toString) must be >= 0
+ str must startWith("<span>Welcome to")
+ }
+ }
+}
View
23 scala_29/lift_json/build.sbt
@@ -0,0 +1,23 @@
+name := "Lift 2.5 starter template"
+
+version := "0.0.1"
+
+organization := "net.liftweb"
+
+scalaVersion := "2.10.0"
+
+resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
+ "releases" at "http://oss.sonatype.org/content/repositories/releases"
+ )
+
+scalacOptions ++= Seq("-deprecation", "-unchecked")
+
+libraryDependencies ++= {
+ val liftVersion = "2.5"
+ Seq(
+ "net.liftweb" %% "lift-json" % liftVersion % "compile",
+ "ch.qos.logback" % "logback-classic" % "1.0.6",
+ "org.specs2" %% "specs2" % "1.14" % "test"
+ )
+}
+
View
2  scala_29/lift_json/project/build.properties
@@ -0,0 +1,2 @@
+sbt.version=0.12.2
+
View
13 scala_29/lift_json/project/plugins.sbt
@@ -0,0 +1,13 @@
+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.10"
+ case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
+ case x if x startsWith "0.12" => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
+})
+
+//Enable the sbt idea plugin
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0")
+
+//Enable the sbt eclipse plugin
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.2")
View
1  scala_29/lift_json/sbt
@@ -0,0 +1 @@
+java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launch-0.12.1.jar "$@"
View
BIN  scala_29/lift_json/sbt-launch-0.12.1.jar
Binary file not shown
View
2  scala_29/lift_json/sbt.bat
@@ -0,0 +1,2 @@
+set SCRIPT_DIR=%~dp0
+java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx1024M -Xss2M -jar "%SCRIPT_DIR%\sbt-launch-0.12.1.jar" %*
View
23 scala_29/lift_json/src/test/resources/logback-test.xml
@@ -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>
View
28 scala_29/lift_json/src/test/scala/code/json/JsonSpecs.scala
@@ -0,0 +1,28 @@
+package code.json
+
+import org.specs2.mutable.Specification
+import net.liftweb.json._
+
+class JsonSpecs extends Specification{
+
+ implicit val format = DefaultFormats
+ val json = parse("""{"name" : "John", "age" : 30}""")
+ case class Person(name: String, age: Int)
+ case class FakePerson(sudo: String, age: Int)
+
+
+
+ "Lift Json" should{
+ "extract the name value" in {
+ json.extract[Person].name must_== "John"
+ }
+ "extract the age value" in {
+ json.extract[Person].age must_== 30
+ }
+ "throw an exception" in {
+ json.extract[FakePerson].sudo must throwA[MappingException]
+ }
+
+ }
+
+}
View
32 scala_29/lift_mvc/build.sbt
@@ -0,0 +1,32 @@
+name := "Lift 2.5 starter template"
+
+version := "0.0.1"
+
+organization := "net.liftweb"
+
+scalaVersion := "2.10.0"
+
+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 :_*)
+
+unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }
+
+scalacOptions ++= Seq("-deprecation", "-unchecked")
+
+libraryDependencies ++= {
+ val liftVersion = "2.5"
+ Seq(
+ "net.liftweb" %% "lift-webkit" % liftVersion % "compile",
+ "net.liftweb" %% "lift-mapper" % liftVersion % "compile",
+ "net.liftmodules" %% "lift-jquery-module_2.5" % "2.3",
+ "org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container,test",
+ "org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
+ "ch.qos.logback" % "logback-classic" % "1.0.6",
+ "org.specs2" %% "specs2" % "1.14" % "test",
+ "com.h2database" % "h2" % "1.3.167"
+ )
+}
+
View
2  scala_29/lift_mvc/project/build.properties
@@ -0,0 +1,2 @@
+sbt.version=0.12.2
+
View
13 scala_29/lift_mvc/project/plugins.sbt
@@ -0,0 +1,13 @@
+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.10"
+ case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
+ case x if x startsWith "0.12" => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
+})
+
+//Enable the sbt idea plugin
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.3.0")
+
+//Enable the sbt eclipse plugin
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.2")
View
1  scala_29/lift_mvc/sbt
@@ -0,0 +1 @@
+java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launch-0.12.1.jar "$@"
View
BIN  scala_29/lift_mvc/sbt-launch-0.12.1.jar
Binary file not shown
View
2  scala_29/lift_mvc/sbt.bat
@@ -0,0 +1,2 @@
+set SCRIPT_DIR=%~dp0
+java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx1024M -Xss2M -jar "%SCRIPT_DIR%\sbt-launch-0.12.1.jar" %*
View
0  scala_29/lift_mvc/src/main/resources/.keep
No changes.
View
23 scala_29/lift_mvc/src/main/resources/logback.xml
@@ -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>
View
0  scala_29/lift_mvc/src/main/resources/props/default.props
No changes.
View
46 scala_29/lift_mvc/src/main/scala/bootstrap/liftweb/Boot.scala
@@ -0,0 +1,46 @@
+package bootstrap.liftweb
+
+import net.liftweb._
+import util._
+import Helpers._
+
+import common._
+import http._
+
+import code.controller._
+import net.liftmodules.JQueryModule
+
+
+/**
+ * A class that's instantiated early and run. It allows the application
+ * to modify lift's environment
+ */
+class Boot {
+ def boot {
+ // where to search snippet
+ LiftRules.addToPackages("code")
+
+ LiftRules.jsArtifacts = net.liftweb.http.js.jquery.JQueryArtifacts
+
+ //Show the spinny image when an Ajax call starts
+ LiftRules.ajaxStart =
+ Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
+
+ // Make the spinny image go away when it ends
+ LiftRules.ajaxEnd =
+ Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd)
+
+ // Force the request to be UTF-8
+ 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()
+ }
+}
View
0  scala_29/lift_mvc/src/main/scala/code/comet/.keep
No changes.
View
31 scala_29/lift_mvc/src/main/scala/code/controller/RootController.scala
@@ -0,0 +1,31 @@
+package code
+package controller
+
+import net.liftweb.http._
+import net.liftweb.util._
+import java.util.Date
+import code.lib._
+import Helpers._
+
+/**
+ * A simple MVC controller. This controller will intercept
+ * the given URL and will transform the reterm page based on
+ * some computed value
+ */
+object RootController extends MVCHelper {
+
+ // Update the time on the index (home) page
+ serve {
+ case "index" :: Nil => {
+ // replace the contents of the element with id "time" with the date
+ "#time *" #> DependencyFactory.inject[Date].map(_.toString)
+ }
+ }
+
+ // serve a page if and only if the second URL param
+ // is an Int
+ serve {
+ case "show_int" :: AsInt(param) :: Nil =>
+ "#int_value" #> param
+ }
+}
View
55 scala_29/lift_mvc/src/main/scala/code/lib/DependencyFactory.scala
@@ -0,0 +1,55 @@
+package code
+package lib
+
+import net.liftweb._
+import http._
+import util._
+import common._
+import java.util.Date
+
+/**
+ * A factory for generating new instances of Date. You can create
+ * factories for each kind of thing you want to vend in your application.
+ * An example is a payment gateway. You can change the default implementation,
+ * or override the default implementation on a session, request or current call
+ * stack basis.
+ */
+object DependencyFactory extends Factory {
+ implicit object time extends FactoryMaker(Helpers.now _)
+
+ /**
+ * objects in Scala are lazily created. The init()
+ * method creates a List of all the objects. This
+ * results in all the objects getting initialized and
+ * registering their types with the dependency injector
+ */
+ private def init() {
+ List(time)
+ }
+ init()
+}
+
+/*
+/**
+ * Examples of changing the implementation
+ */
+sealed abstract class Changer {
+ def changeDefaultImplementation() {
+ DependencyFactory.time.default.set(() => new Date())
+ }
+
+ def changeSessionImplementation() {
+ DependencyFactory.time.session.set(() => new Date())
+ }
+
+ def changeRequestImplementation() {
+ DependencyFactory.time.request.set(() => new Date())
+ }
+
+ def changeJustForCall(d: Date) {
+ DependencyFactory.time.doWith(d) {
+ // perform some calculations here
+ }
+ }
+}
+*/
View
0  scala_29/lift_mvc/src/main/scala/code/model/.keep
No changes.
View
0  scala_29/lift_mvc/src/main/scala/code/snippet/.keep
No changes.
View
0  scala_29/lift_mvc/src/main/scala/code/view/.keep
No changes.
View
21 scala_29/lift_mvc/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+"http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+<filter>
+ <filter-name>LiftFilter</filter-name>
+ <display-name>Lift Filter</display-name>
+ <description>The Filter that intercepts lift calls</description>
+ <filter-class>net.liftweb.http.LiftFilter</filter-class>
+</filter>
+
+
+<filter-mapping>
+ <filter-name>LiftFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+</filter-mapping>
+
+</web-app>
View
BIN  scala_29/lift_mvc/src/main/webapp/images/ajax-loader.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
36 scala_29/lift_mvc/src/main/webapp/index.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><title>Home</title></head>
+ <body class="lift:content_id=main">
+ <div id="main" class="lift:surround?with=default;at=content">
+ <head> <!-- Set the title of the page -->
+ <title>Home Page</title>
+ </head>
+
+ <h2>Welcome to your project!</h2>
+
+ <p>
+ Welcome to your Lift app at <span id="time">Time goes here</span>
+ <br/>
+
+ <br/>
+
+ The time was set in <code>code.controller.RootController</code>
+ </p>
+
+ <hr />
+
+ <p>
+ An example of Lift's MVCHelper routing via URL Path:
+ <div>
+ <form action="/show_int" onsubmit="window.location = this.action+'/'+encodeURIComponent(this['int'].value); return false">
+ Enter an Integer value: <input id="int" name="int" value="5"/>
+ <br />
+ <input type="submit" value="Show Int"/>
+ </form>
+ </div>
+ </p>
+ </div>
+ </body>
+</html>
+
View
26 scala_29/lift_mvc/src/main/webapp/show_int.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head><meta content="text/html; charset=UTF-8" http-equiv="content-type" /><title>Home</title></head>
+ <body class="lift:content_id=main">
+ <div id="main" class="lift:surround?with=default;at=content">
+ <head> <!-- Set the title of the page -->
+ <title>Show Int Page</title>
+ </head>
+
+ <p>
+ The Integer value of the second path parameter is
+ <span id="int_value">
+ undefined. To display the Int value here, browse to
+ /show_int/123
+ </span>
+
+ <br />
+ <br />
+
+ The int_value span was set in
+ <code>code.controller.RootController</code>
+ </p>
+ </div>
+ </body>
+</html>
+
View
76 scala_29/lift_mvc/src/main/webapp/templates-hidden/default.html
@@ -0,0 +1,76 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:lift="http://liftweb.net/">
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <meta name="description" content="" />
+ <meta name="keywords" content="" />
+ <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 {
+ display: block;
+ color: red;
+}
+
+.sidebar ul {
+ margin:0;
+ padding:0;
+ border-bottom:1px solid #ccc;
+}
+
+
+.sidebar ul li {
+ margin:0;
+ padding:0;
+ list-style:none;
+ border:1px solid #ccc;
+ border-bottom:none;
+}
+
+.sidebar ul li a {
+ display:block;
+ padding:3px;
+ text-indent:30px;
+ text-decoration:none;
+}
+
+.sidebar ul li span {
+ display:block;
+ padding:3px;
+ text-indent:30px;
+ text-decoration:none;
+}
+
+.sidebar ul li a:hover {
+ background-color: #eee;
+}
+
+
+ /* ]]> */
+ </style>
+ </head>
+ <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>
+ </div>
+ <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-2012 WorldWide Conferencing, LLC.
+ Distributed under an Apache 2.0 License.</h4>
+ </div>
+ </div>
+ </body>
+</html>
View
23 scala_29/lift_mvc/src/main/webapp/templates-hidden/wizard-all.html
@@ -0,0 +1,23 @@
+<div>
+ <wizard:screen_info><div>Page <wizard:screen_number/> of <wizard:total_screens/></div></wizard:screen_info>
+ <wizard:wizard_top> <div> <wizard:bind/> </div> </wizard:wizard_top>
+ <wizard:screen_top> <div> <wizard:bind/> </div> </wizard:screen_top>
+ <wizard:errors> <div> <ul> <wizard:item> <li> <wizard:bind/> </li> </wizard:item> </ul> </div> </wizard:errors>
+ <div> <wizard:fields>
+ <table>
+ <wizard:line>
+ <tr>
+ <td>
+ <wizard:label><label wizard:for=""><wizard:bind/></label></wizard:label>
+ <wizard:help><span><wizard:bind/></span></wizard:help>
+ <wizard:field_errors> <ul> <wizard:error> <li> <wizard:bind/> </li> </wizard:error> </ul> </wizard:field_errors>
+ </td>
+ <td> <wizard:form/> </td>
+ </tr>
+ </wizard:line>
+ </table>
+ </wizard:fields> </div>
+ <div> <table> <tr> <td> <wizard:prev/> </td> <td> <wizard:cancel/> </td> <td> <wizard:next/> </td> </tr> </table> </div>
+ <wizard:screen_bottom> <div> <wizard:bind/> </div> </wizard:screen_bottom>
+ <wizard:wizard_bottom> <div> <wizard:bind/> </div> </wizard:wizard_bottom>
+</div>
View
0  scala_29/lift_mvc/src/test/resources/.keep
No changes.
View
23 scala_29/lift_mvc/src/test/resources/logback-test.xml
@@ -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>
View
34 scala_29/lift_mvc/src/test/scala/RunWebApp.scala
@@ -0,0 +1,34 @@
+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
+ val scc = new SelectChannelConnector
+ scc.setPort(8080)
+ server.setConnectors(Array(scc))
+
+ val context = new WebAppContext()
+ context.setServer(server)
+ context.setWar("src/main/webapp")
+
+ val context0: ContextHandler = new ContextHandler();
+ context0.setHandler(context)
+ server.setHandler(context0)
+
+ try {
+ println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP")
+ server.start()
+ while (System.in.available() == 0) {
+ Thread.sleep(5000)
+ }
+ server.stop()
+ server.join()
+ } catch {
+ case exc: Exception => {
+ exc.printStackTrace()
+ System.exit(100)
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.