Skip to content
Browse files

Updated the method signature of StatelessBehavior per Naftoli's sugge…

…stion
  • Loading branch information...
1 parent a3eca64 commit cf059935a45943099573ca0c089d96a702c1d287 @dpp dpp committed Aug 26, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 web/webkit/src/main/scala/net/liftweb/http/StatefulSnippet.scala
View
10 web/webkit/src/main/scala/net/liftweb/http/StatefulSnippet.scala
@@ -177,7 +177,7 @@ trait StatelessBehavior {
/**
* Given the method name, return the transformation for the method
*/
- def behavior(methodName: String): NodeSeq => NodeSeq
+ def behaviorDispatch: PartialFunction[String, NodeSeq => NodeSeq]
}
/**
@@ -186,12 +186,16 @@ trait StatelessBehavior {
*/
trait DefaultStatelessBehavior extends StatelessBehavior {
def behavior(): NodeSeq => NodeSeq
- def behavior(methodName: String): NodeSeq => NodeSeq = behavior()
+ def behaviorDispatch: PartialFunction[String, NodeSeq => NodeSeq] = {
+ case _ => behavior()
+ }
}
/**
* A "default" implementation of StatelessBehavior. Just ignore everything and return a zero-length Text.
*/
trait BlankStatelessBehavior extends StatelessBehavior {
- def behavior(methodName: String): NodeSeq => NodeSeq = ignore => Text("")
+ def behaviorDispatch: PartialFunction[String, NodeSeq => NodeSeq] = {
+ case _ => ignore => NodeSeq.Empty
+ }
}

0 comments on commit cf05993

Please sign in to comment.
Something went wrong with that request. Please try again.