Skip to content

Instantly share code, notes, and snippets.

@corruptmemory
Created January 14, 2012 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corruptmemory/1609875 to your computer and use it in GitHub Desktop.
Save corruptmemory/1609875 to your computer and use it in GitHub Desktop.
Unfiltered pong
package com.patch.unfiltered_pong
import unfiltered.request._
import unfiltered.response._
import unfiltered.netty.async._
import org.jboss.netty.channel.ChannelHandlerContext
import unfiltered.netty.ServerErrorResponse
trait ApiPlan extends Plan with ServerErrorResponse {
def underlying = ApiExecutor.underlying
}
object ApiExecutor {
import org.jboss.netty.handler.execution._
import java.util.concurrent.Executors
lazy val underlying = new MemoryAwareThreadPoolExecutor(16, 65536, 1048576)
}
object App extends ApiPlan {
final def intent:Plan.Intent = {
case request@GET(Path("/")) => request.respond(Ok ~> PlainTextContent ~> ResponseString("PONG"))
}
}
/** embedded server */
object Server {
def main(args: Array[String]) {
unfiltered.netty.Http(8000).handler(App).run()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment