The following is possible using Python:
$ apt-get install python
$ easy_install Flask
$ cat > hello.py
from flask import Flask
app = Flask(__name__)
@app.rou
You could use an embedded Jetty Server:
/*
* Required Libs: Jetty, Servlet API
*
* Compile:
* scalac -cp jetty-6.1.14.jar:jetty-util-6.1.14.jar:servlet-api-2.5-6.1.14.jar WebServer.scala
*
* Run:
* scala -cp .:jetty-6.1.14.jar:jetty-util-6.1.14.jar:servlet-api-2.5-6.1.14.jar WebServer
*/
import org.mortbay.jetty.Server
import org.mortbay.jetty.servlet.Context
import javax.servlet.http.{HttpServlet,
HttpServletRequest,
HttpServletResponse}
class HelloServlet extends HttpServlet {
override def doGet(req : HttpServletRequest, resp : HttpServletResponse) =
resp.getWriter().print("Hello There!")
}
object WebServer {
def main(args: Array[String]) {
val server = new Server(8080)
val root = new Context(server, "/", Context.SESSIONS)
root.addServlet(classOf[HelloServlet], "/*")
server.start()
println("Point your browser to http://localhost:8080/")
println("Type [CTRL]+[C] to quit!")
Thread.sleep(Long.MaxValue)
}
}
In case you target for a LOC comparison, You use the HTTP server embedded with the Sun JDK. Another solution could be to use javax.xml.ws.Endpoint and the Provider API.