Skip to content

Instantly share code, notes, and snippets.

@jamesgolick
Forked from joegaudet/gist:2839122
Created May 30, 2012 21:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesgolick/2839152 to your computer and use it in GitHub Desktop.
Save jamesgolick/2839152 to your computer and use it in GitHub Desktop.
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