Created
April 3, 2012 03:54
I'm gonna populate that cache with my...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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