Skip to content

Instantly share code, notes, and snippets.

@jurrchen
Created April 3, 2012 03:54
I'm gonna populate that cache with my...
private def populateRoutesCache = {
val classLoader = this.getClass.getClassLoader
val routesStream = classLoader.getResourceAsStream("routes")
val routesString = Source.fromInputStream(routesStream).getLines().mkString("\n")
val parser = new RouteFileParser
val parsedRoutes = parser.parse(routesString)
parsedRoutes match {
case parser.Success(routes,_) => {
routes map {
route => {
val routeStat = List(route.call.packageName + "." + route.call.controller + "." + route.call.method)
val routeFunc = Route(route.verb.toString, route.path)
(routeFunc,routeStat)
}
} toList
}
case _ => throw new Exception("problem with parsing routes")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment