Skip to content

cosminbasca/simplehttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simplehttp

simplehttp is simplistic extender of the Simpleframework api

Important Notes

This software is the product of research carried out at the University of Zurich and comes with no warranty whatsoever. Have fun!

TODO's

  • unit tests
  • more documentation
  • (more) examples

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) = {}
}

Gotcha's

Every time the project version information is changed, BuildInfo needs to be regenerated. To do that simply run:

$ sbt compile

Thanks a lot to

About

a simplistic extender of the simpleframework's api in scala

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published