Browse files

Regenerated from scalatra-sbt.g8.

  • Loading branch information...
1 parent 492b0cd commit 67babee82eede7b54cce784a1c09f0671bc5da13 @rossabaker rossabaker committed Mar 12, 2012
View
13 README.md
@@ -0,0 +1,13 @@
+1. Launch [SBT](http://code.google.com/p/simple-build-tool).
+
+ ./sbt
+
+2. Run Jetty
+
+ container:start
+
+3. Go to http://localhost:8080/.
+
+4. Learn more at http://www.scalatra.org/stable/book.
+
+5. Happy hacking!
View
20 build.sbt
@@ -0,0 +1,20 @@
+organization := "com.example"
+
+name := "scalatra-sbt-prototype"
+
+version := "0.1.0-SNAPSHOT"
+
+scalaVersion := "2.9.1"
+
+seq(webSettings :_*)
+
+libraryDependencies ++= Seq(
+ "org.scalatra" %% "scalatra" % "2.0.4",
+ "org.scalatra" %% "scalatra-scalate" % "2.0.4",
+ "org.scalatra" %% "scalatra-specs2" % "2.0.4" % "test",
+ "ch.qos.logback" % "logback-classic" % "1.0.0" % "runtime",
+ "org.eclipse.jetty" % "jetty-webapp" % "7.5.4.v20111024" % "container",
+ "javax.servlet" % "servlet-api" % "2.5" % "provided"
+)
+
+resolvers += "Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
View
1 project/build.properties
@@ -0,0 +1 @@
+sbt.version=0.11.2
View
1 project/plugins.sbt
@@ -0,0 +1 @@
+libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.10"))
View
13 src/main/resources/logback.xml
@@ -0,0 +1,13 @@
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="info">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
View
24 src/main/scala/com/example/app/MyScalatraServlet.scala
@@ -0,0 +1,24 @@
+package com.example.app
+
+import org.scalatra._
+import scalate.ScalateSupport
+
+class MyScalatraServlet extends ScalatraServlet with ScalateSupport {
+
+ get("/") {
+ <html>
+ <body>
+ <h1>Hello, world!</h1>
+ Say <a href="hello-scalate">hello to Scalate</a>.
+ </body>
+ </html>
+ }
+
+ notFound {
+ // Try to render a ScalateTemplate if no route matched
+ findTemplate(requestPath) map { path =>
+ contentType = "text/html"
+ layoutTemplate(path)
+ } orElse serveStaticResource() getOrElse resourceNotFound()
+ }
+}
View
12 src/main/webapp/WEB-INF/layouts/default.scaml
@@ -0,0 +1,12 @@
+-@ val title: String
+-@ val headline: String = title
+-@ val body: String
+
+!!!
+%html
+ %head
+ %title= title
+ %body
+ #content
+ %h1= headline
+ != body
View
4 src/main/webapp/WEB-INF/views/hello-scalate.scaml
@@ -0,0 +1,4 @@
+- attributes("title") = "Scalatra: a tiny, Sinatra-like web framework for Scala"
+- attributes("headline") = "Welcome to Scalatra"
+
+Hello, Scalate!
View
26 src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <servlet>
+ <servlet-name>scalatra</servlet-name>
+ <servlet-class>
+ com.example.app.MyScalatraServlet
+ </servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>scalatra</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+ <!-- Static Asset Serving Example -->
+ <!--
+ <servlet-mapping>
+ <servlet-name>default</servlet-name>
+ <url-pattern>/img/*</url-pattern>
+ <url-pattern>/css/*</url-pattern>
+ <url-pattern>/js/*</url-pattern>
+ </servlet-mapping>
+ -->
+</web-app>
View
16 src/test/scala/com/example/app/MyScalatraServletSpec.scala
@@ -0,0 +1,16 @@
+package com.example.app
+
+import org.scalatra.test.specs2._
+
+// For more on Specs2, see http://etorreborre.github.com/specs2/guide/org.specs2.guide.QuickStart.html
+class MyScalatraServletSpec extends ScalatraSpec { def is =
+ "GET / on MyScalatraServlet" ^
+ "should return status 200" ! root200^
+ end
+
+ addServlet(classOf[MyScalatraServlet], "/*")
+
+ def root200 = get("/") {
+ status must_== 200
+ }
+}

0 comments on commit 67babee

Please sign in to comment.