Permalink
Browse files

Added Documentation for prefix stuff

  • Loading branch information...
1 parent 454ad8b commit 980b841bc0a642b959a3854cda3f0f5d84eafb94 @dpp dpp committed Mar 3, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 web/webkit/src/main/scala/net/liftweb/http/rest/RestHelper.scala
@@ -615,6 +615,15 @@ trait RestHelper extends LiftRules.DispatchPF {
final class ListServeMagic(list: List[String]) {
val listLen = list.length
+ /**
+ * Used in conjunction with RestHelper.serveJx to
+ * prefix the pattern matched path. For example:
+ * <code>
+ * serveJx[Foo]("foo" / "bar" prefixJx {
+ * case FindBaz(baz) :: Nil Get _ => baz
+ * })
+ * </code>
+ */
def prefixJx[T](pf: PartialFunction[Req, BoxOrRaw[T]]): PartialFunction[Req, BoxOrRaw[T]] =
new PartialFunction[Req, BoxOrRaw[T]] {
def isDefinedAt(req: Req): Boolean =
@@ -627,6 +636,16 @@ final class ListServeMagic(list: List[String]) {
}
+ /**
+ * Used in conjunction with RestHelper.serveJx to
+ * prefix the pattern matched path. For example:
+ * <code>
+ * serve("foo" / "bar" prefix {
+ * case FindBaz(baz) :: Nil GetJson _ => baz: JValue
+ * case FindBaz(baz) :: Nil GetXml _ => baz: Node
+ * })
+ * </code>
+ */
def prefix(pf: PartialFunction[Req, () => Box[LiftResponse]]):
PartialFunction[Req, () => Box[LiftResponse]] =
new PartialFunction[Req, () => Box[LiftResponse]] {

0 comments on commit 980b841

Please sign in to comment.