Browse files

Also use a listener

  • Loading branch information...
1 parent 55ad15b commit 058d0aa6fd07c390fa7ebc09c531541c58699e44 @casualjim casualjim committed Oct 4, 2012
Showing with 21 additions and 23 deletions.
  1. +9 −0 src/main/g8/src/main/scala/Scalatra.scala
  2. +12 −23 src/main/g8/src/main/webapp/WEB-INF/web.xml
View
9 src/main/g8/src/main/scala/Scalatra.scala
@@ -0,0 +1,9 @@
+import $package$._
+import org.scalatra._
+import javax.servlet.ServletContext
+
+class Scalatra extends LifeCycle {
+ override def init(context: ServletContext) {
+ context.mount(new $servlet_name$, "/*")
+ }
+}
View
35 src/main/g8/src/main/webapp/WEB-INF/web.xml
@@ -1,26 +1,15 @@
<?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>
- $package$.$servlet_name$
- </servlet-class>
- </servlet>
+<web-app 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_3_0.xsd"
+ version="3.0">
- <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>
- -->
+ <!--
+ This listener loads a class in the default package called Scalatra.
+ That class should should implement org.scalatra.LifeCycle. Your app
+ can be configured in Scala code there.
+ -->
+ <listener>
+ <listener-class>org.scalatra.servlet.ScalatraListener</listener-class>
+ </listener>
</web-app>

0 comments on commit 058d0aa

Please sign in to comment.