If I have a URL like http://localhost/Test/edit/{id} and I would like the {id} transform to a parameter instead of URL path part.
Is it best way to do it by create a menu with RewriteRequest? Because I found it a little boilerplate if I have lot URL pattern like this.
val menu = Menu(new Loc[Unit] {
override def name = "Test"
override def text = "Test"
override def link = (List ("Test"), true)
override def params = Nil
override def defaultValue = Full(())
def isTarget (path: ParsePath) = path match {
case ParsePath (List("Test", "edit", id), _, _, _) => true
case _ => false
}
override def rewrite = Full ( NamedPF("Test") {
case RewriteRequest (path, _, _) if isTarget(path) =>
RewriteResponse(List("Test", "edit"),
Map("id" -> "1024")) -> ()
})
})