Permalink
Browse files

Remove type param from Application; it's awkward in practice.

  • Loading branch information...
1 parent 686a62d commit f012cf35f7ca16a0e6e9bf138ddf6baf020ada61 @rossabaker rossabaker committed Nov 1, 2010
@@ -3,8 +3,8 @@ package org.scalatra.ssgi
/**
* An application is a function that takes exactly one argument, a request, and returns a response.
*/
-trait Application[+A] extends (Request => Response[A])
+trait Application extends (Request => Response[_])
object Application {
- implicit def apply[A](f: Request => Response[A]) = new Application[A]{ def apply(req: Request) = f(req) }
+ implicit def apply(f: Request => Response[_]) = new Application { def apply(req: Request) = f(req) }
}
@@ -3,6 +3,6 @@ package examples.servlet
import scala.xml.NodeSeq
-class HelloWorldApp extends Application[NodeSeq] {
- def apply(v1: Request): Response[NodeSeq] = Response(body = <h1>Hello, world!</h1>)
+class HelloWorldApp extends Application {
+ def apply(v1: Request) = Response(body = <h1>Hello, world!</h1>)
}
@@ -8,7 +8,7 @@ import java.nio.charset.Charset
class SsgiServlet extends HttpServlet {
import SsgiServlet._
- private var application: Application[_] = _
+ private var application: Application = _
override def init(config: ServletConfig) {
config.getInitParameter(ApplicationClassName) match {
@@ -19,7 +19,7 @@ class SsgiServlet extends HttpServlet {
protected def loadApplication(className: String) {
val appClass = getClass.getClassLoader.loadClass(className)
- application = appClass.newInstance.asInstanceOf[Application[_]]
+ application = appClass.newInstance.asInstanceOf[Application]
}
override def service(req: HttpServletRequest, resp: HttpServletResponse) = {

0 comments on commit f012cf3

Please sign in to comment.