Skip to content

Instantly share code, notes, and snippets.

@berngp
Created November 11, 2011 19:06
Show Gist options
  • Save berngp/1358895 to your computer and use it in GitHub Desktop.
Save berngp/1358895 to your computer and use it in GitHub Desktop.
Lift RestHelper and the SI-1133
/**
* Fails with https://issues.scala-lang.org/browse/SI-1133
* Workaround: Split the <i>cases</i> inside <i>serve</i> into two or more
* <i>serve</i> blocks.
*
* Note: To avoid noise all cases bellow are returning a NotFoundResponse().
*/
object CategoryAdminResource extends RestHelper with Loggable {
serve("api" / "categories" prefix {
case "tags" :: tag :: Nil JsonGet _ => NotFoundResponse() //...
case Category(category) :: "tags" :: Nil JsonGet _ => NotFoundResponse() //...
case Category(category) :: "tags" :: tagSlug :: Nil JsonGet _ => NotFoundResponse() //...
case Category(category) :: Nil JsonGet _ => NotFoundResponse() //...
case Category(category) :: "tags" :: Nil JsonPut json -> _ => NotFoundResponse() //...
case Category(category) :: "tags" :: tagSlug :: Nil JsonDelete _ => NotFoundResponse() //...
case Category(category) :: "tags" :: tagSlug :: Nil JsonPost json -> _ => NotFoundResponse() //...
case Nil JsonGet _ => NotFoundResponse() //...
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment