-
-
Save jamesgolick/2839152 to your computer and use it in GitHub Desktop.
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
package org.objectify.adapters | |
import org.objectify.HttpMethod._ | |
import org.objectify.Action | |
import org.objectify.Objectify | |
import org.scalatra.servlet.ServletBase | |
trait ScalatraAdapter extends Objectify with ServletBase { | |
/** | |
* Decorates the default bootstrap which has the configuration | |
* validation in it | |
*/ | |
override def bootstrap = { | |
super.bootstrap | |
actions.foreach(case Action(verb, name, route, policies, service, responder) => { | |
val act = verb match { | |
case Options => options _ | |
case Get => get _ | |
case Post => post _ | |
case Put => put _ | |
case Delete => delete _ | |
case Patch => patch _ | |
} | |
act(route.getOrElse(throw new RuntimeException("No Route Found"))){ | |
execute(action, request, response) | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment