Skip to content

Instantly share code, notes, and snippets.

@aolshevskiy
Created July 10, 2011 21:38
Show Gist options
  • Save aolshevskiy/1074994 to your computer and use it in GitHub Desktop.
Save aolshevskiy/1074994 to your computer and use it in GitHub Desktop.
Test scalatra project
name := "web"
version := "1.0"
scalaVersion := "2.9.0"
seq(webSettings :_*)
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % "2.0.0-SNAPSHOT",
"org.scalatra" %% "scalatra-scalate" % "2.0.0-SNAPSHOT",
"org.mortbay.jetty" % "jetty" % "6.1.22" % "jetty",
"javax.servlet" % "servlet-api" % "2.5" % "provided->default"
)
fork in run := true
// needed for the scalatra snapshots
resolvers ++= Seq(
"Sonatype OSS Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
)
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.1.0-"+v))
import org.scalatra._
class Web extends ScalatraFilter {
before {
contentType = "text/html"
}
get("/") {
<h1>Hello, world!</h1>
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<filter>
<filter-name>scalatra</filter-name>
<filter-class>Web</filter-class>
</filter>
<filter-mapping>
<filter-name>scalatra</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment