simplehttp is simplistic extender of the Simpleframework api
This software is the product of research carried out at the University of Zurich and comes with no warranty whatsoever. Have fun!
- unit tests
- more documentation
- (more) examples
import org.simpleframework.http.Request
import com.simplehttp.{MimeTypes, HttpRouteHandler}
import com.simplehttp.ApplicationContainer
import com.simplehttp.LocalNotifierServer
class PingContext() {
}
class PingHandler extends HttpRouteHandler[PingContext] {
override def contentType: MimeTypes.Value = MimeTypes.Text
override def process(request: Request, application: Option[PingContext]): Either[String, Array[Byte]] = {
Left("pong")
}
}
class PingContainer (val context:PingContext) extends ApplicationContainer(Some(context)) {
routes += "/ping" -> new PingHandler
}
object PingServer extends LocalNotifierServer[PingContext, PingContainer] {
override def container(sources: Seq[String]): ProtocolContainer = {
new PingContainer(new PingContext())
}
override def cleanup(container: ProtocolContainer) = {}
}
Every time the project version information is changed, BuildInfo needs to be regenerated. To do that simply run:
$ sbt compile
- University of Zurich and the Swiss National Science Foundation for generously funding the research that led to this software.