Skip to content

Commit

Permalink
Added Documentation for prefix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
dpp committed Mar 3, 2011
1 parent 454ad8b commit 980b841
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions web/webkit/src/main/scala/net/liftweb/http/rest/RestHelper.scala
Expand Up @@ -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 =
Expand All @@ -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]] {
Expand Down

0 comments on commit 980b841

Please sign in to comment.