Skip to content

Instantly share code, notes, and snippets.

@matthandlersux
Created June 5, 2012 18:39
Show Gist options
  • Save matthandlersux/2876808 to your computer and use it in GitHub Desktop.
Save matthandlersux/2876808 to your computer and use it in GitHub Desktop.
package com.aaop.humanfacebigdata.controllers
import org.bowlerframework.controller.{Controller,FunctionNameConventionRoutes}
import org.bowlerframework.model.{ ParameterMapper, Validations}
import org.bowlerframework.view.{Renderable}
import org.bowlerframework.model.Validations
import org.bowlerframework.view.{Renderable, ViewPath}
import org.bowlerframework.view.scalate.DefaultLayout
import org.bowlerframework._
import controller.{FunctionNameConventionRoutes, Controller, LayoutAware}
import com.twitter.conversions.time._
import com.twitter.util._
import java.{util => ju}
import java.util.{concurrent => juc}
import scala.collection.JavaConversions._
import com.twitter.cassie._
import com.twitter.finagle.stats.{StatsReceiver, NullStatsReceiver}
/**
*
* extends:
* - Controller: used to construct routes and deal with them by providing functions that respond to routes.
* - ParameterMapper: takes a request and maps any values into beans or other objects.
* - Validations: validation enables the Controller
* - Renderable: allows you to render View Model objects.
*/
class MyController extends Controller with ParameterMapper with Validations with Renderable with FunctionNameConventionRoutes {
// test
def `GET /test` = {
val cluster = new Cluster("localhost", NullStatsReceiver)
val keyspace = cluster.keyspace("humanfacebigdata").connect()
RequestScope.response.setStatus(402)
}
// index
def `GET /` = render
// registration
def `GET /api/register` = RequestScope.response.setStatus(200)
def `POST /api/register` = RequestScope.response.setStatus(200)
// image upload
def `POST /api/upload/image` = RequestScope.response.setStatus(200)
// audio upload
def `POST /api/upload/audio` = RequestScope.response.setStatus(200)
// passive data upload
def `POST /api/upload/data` = RequestScope.response.setStatus(200)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment