org.scalatra.UrlGenerator.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalatra_2.8.2.RC1 Show documentation
Show all versions of scalatra_2.8.2.RC1 Show documentation
The core Scalatra framework
The newest version!
package org.scalatra
trait UrlGeneratorSupport {
def url(route: Route, params: Pair[String, String]*): String =
url(route, params.toMap)
def url(route: Route, splat: String, moreSplats: String*): String =
url(route, Map[String, String](), splat +: moreSplats)
def url(
route: Route,
params: Map[String, String] = Map(),
splats: Iterable[String] = Seq()
): String =
route.reversibleMatcher match {
case Some(matcher: ReversibleRouteMatcher) => route.contextPath() + matcher.reverse(params, splats.toList)
case None =>
throw new Exception("Route \"%s\" is not reversible" format (route))
}
}
object UrlGenerator extends UrlGeneratorSupport
© 2015 - 2024 Weber Informatics LLC | Privacy Policy