Skip to content

Instantly share code, notes, and snippets.

@xerial
xerial / RequestDispatcher.scala
Last active September 3, 2015 07:32 — forked from seratch/app.scala
AutoRouting idea
import xerial.lens.ObjectSchema
class RequestDispatcher {
// Prepare mappings from a path to ObjectSchema of an WebApp class
private val webAppMapping = {
// ObjectSchema contains a list of methods
for(cl <- webAppClasses; schema <- ObjectSchema.of(cl)) yield {
val basePath = m.findAnnotaionOf[path].map(_.value)getOrElse("/" + schema.name)
basePath -> schema