Created
January 14, 2012 02:02
-
-
Save corruptmemory/1609875 to your computer and use it in GitHub Desktop.
Unfiltered pong
This file contains hidden or 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 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