diff options
author | buraq <buraq@epfl.ch> | 2004-07-26 13:16:32 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2004-07-26 13:16:32 +0000 |
commit | c7010a999567ec09232f86b80b2cb78a30dcc9c0 (patch) | |
tree | 4e15707febabd3fd4f3760e0eec11ff85d155aa5 | |
parent | ca1842d677cc9c1a70eea3cda8f12f05814ecff0 (diff) | |
download | scala-c7010a999567ec09232f86b80b2cb78a30dcc9c0.tar.gz scala-c7010a999567ec09232f86b80b2cb78a30dcc9c0.tar.bz2 scala-c7010a999567ec09232f86b80b2cb78a30dcc9c0.zip |
rename
-rw-r--r-- | sources/scala/tools/servletEngine/Connector.scala | 25 | ||||
-rw-r--r-- | sources/scala/tools/servletEngine/ExcepServlet.scala | 23 | ||||
-rw-r--r-- | sources/scala/tools/servletEngine/Main.scala | 25 | ||||
-rw-r--r-- | sources/scala/tools/servletEngine/Mapping.scala | 24 | ||||
-rw-r--r-- | sources/scala/tools/servletEngine/SERVLET.scala | 29 | ||||
-rw-r--r-- | sources/scala/tools/servletEngine/ScalaCookiee.scala | 14 | ||||
-rw-r--r-- | sources/scala/tools/servletEngine/ScalaServlet.scala | 59 | ||||
-rw-r--r-- | sources/scala/tools/servletEngine/ServletException.scala | 13 |
8 files changed, 0 insertions, 212 deletions
diff --git a/sources/scala/tools/servletEngine/Connector.scala b/sources/scala/tools/servletEngine/Connector.scala deleted file mode 100644 index b315d16ef5..0000000000 --- a/sources/scala/tools/servletEngine/Connector.scala +++ /dev/null @@ -1,25 +0,0 @@ -package scala.tools.servletEngine; - -import java.net.{ Socket, ServerSocket }; - -/** for every port, there is one connector that instantiates a handler - * per client connection - */ -abstract class Connector(thePort: Int) extends Thread { - super.setDaemon(true); - - /** concrete instances of Connectors must override this with a factory - * for protocol handlers - */ - def makeHandler(s: Socket): Thread; //Handler; - - final val port = thePort; - final val serverSocket = new ServerSocket(thePort); - - // @todo: handler pooling - final override def run() = while(true) { - val client = serverSocket.accept(); /* returns a socket upon connection */ - val t = makeHandler(client); - t.start(); - } -} diff --git a/sources/scala/tools/servletEngine/ExcepServlet.scala b/sources/scala/tools/servletEngine/ExcepServlet.scala deleted file mode 100644 index 822b9e8097..0000000000 --- a/sources/scala/tools/servletEngine/ExcepServlet.scala +++ /dev/null @@ -1,23 +0,0 @@ -package scala.tools.servletEngine; -import java.io._; -import scala.xml._; -import scala.collection.mutable.HashMap ; - -class ExcepServlet() extends ScalaServlet{ - -override def doGetXML(info: HashMap[String,String]): Node = { - val code:String= info("code"); - val detail:String=info("detail"); - - <html> - <head> - <title>SERVLET ERROR</title> - </head> - <body> - <big>Attention,erreur dans la servlet</big> - <br/>type de l erreur: { code }<br/>{ detail } - </body> - </html> -} - -} diff --git a/sources/scala/tools/servletEngine/Main.scala b/sources/scala/tools/servletEngine/Main.scala deleted file mode 100644 index 0ec47d735c..0000000000 --- a/sources/scala/tools/servletEngine/Main.scala +++ /dev/null @@ -1,25 +0,0 @@ -package scala.tools.servletEngine; - -import java.net.ServerSocket; - -/** Main loop of the servlet engine, opens a ServerSocket - * and spawns a thread when accepting a client connections. - * - * servletEngine depends on mappings - * <ul> - * <li>p: ports to protocol, and</li> - * <li>s: url to servlet</li> - * </ul> - */ -object Main { - - //@todo make this configurable with ports and handlers - private var hcon: Thread = new http.HttpConnector(8000); - def main(args: Array[String]): Unit = { - Console.println("starting http connector at 8000"); - hcon.start(); - while(true) { - Thread.sleep(50000) - } - } -} diff --git a/sources/scala/tools/servletEngine/Mapping.scala b/sources/scala/tools/servletEngine/Mapping.scala deleted file mode 100644 index b389c964d9..0000000000 --- a/sources/scala/tools/servletEngine/Mapping.scala +++ /dev/null @@ -1,24 +0,0 @@ -package scala.tools.servletEngine; - -import java.io._; - -class Mapping(){ - - val map = new File(http.HTTP.SERVER_LOCATION,http.HTTP.translateFilename("map.prop")); - val myProp = new java.util.Properties(); - - try{ - myProp.load(new FileInputStream(map)); - } - - catch{ - case e:FileNotFoundException => System.out.println("FileNotFoundException "); - case e:IOException => System.out.println("IOException"); - case e: IllegalArgumentException => System.out.println(" IllegalArgumentException"); - } - - def switch(original:String):String={ - myProp.getProperty(original); - } - -} diff --git a/sources/scala/tools/servletEngine/SERVLET.scala b/sources/scala/tools/servletEngine/SERVLET.scala deleted file mode 100644 index 7badf7d826..0000000000 --- a/sources/scala/tools/servletEngine/SERVLET.scala +++ /dev/null @@ -1,29 +0,0 @@ -package scala.tools.servletEngine; - -import java.io._; -import java.util._; -import java.net._; - -object SERVLET { - - final val STATUS_OKAY = 50; - final val STATUS_NOT_IMPLEMENTED= 60; - final val STATUS_FORBIDDEN=70; - final val STATUS_NOT_FOUND=80; - final val STATUS_BAD_REQUEST= 90; - final val STATUS_INTERNAL_ERROR =99; - - - - def getCodeMessage (code:int): String = code match { - - case STATUS_OKAY => "OK" - case STATUS_BAD_REQUEST=> "Bad Request" - case STATUS_FORBIDDEN => "Forbidden" - case STATUS_NOT_FOUND => "Not Found" - case STATUS_INTERNAL_ERROR => "Server Internal Error" - case STATUS_NOT_IMPLEMENTED => "Not Implemented" - case _ => "Unknown Code (" + code + ")" - - } -} diff --git a/sources/scala/tools/servletEngine/ScalaCookiee.scala b/sources/scala/tools/servletEngine/ScalaCookiee.scala deleted file mode 100644 index 1215bae48b..0000000000 --- a/sources/scala/tools/servletEngine/ScalaCookiee.scala +++ /dev/null @@ -1,14 +0,0 @@ -package scala.tools.servletEngine; - -import java.io._; - -class ScalaCookiee(name:String,value:String) { - - def getName():String ={ - name; - } - - def getValue():String={ - value; - } -} diff --git a/sources/scala/tools/servletEngine/ScalaServlet.scala b/sources/scala/tools/servletEngine/ScalaServlet.scala deleted file mode 100644 index 6ece5f0e71..0000000000 --- a/sources/scala/tools/servletEngine/ScalaServlet.scala +++ /dev/null @@ -1,59 +0,0 @@ -package scala.tools.servletEngine; - -import java.io.IOException; -import scala.xml._; -import scala.collection.mutable.HashMap ; -import http.HttpOutputStream; -// import scala.collection.mutable.HashMap -// val x = new HashMap[String,String] -// x.update("key","value"); -// x.get("key") match { -// case Some( value ) => ... -// case None => ... -// } x("key") - -abstract class ScalaServlet { - var output:HttpOutputStream = null; - // HashMap[String,String] - def doGetXML(info: HashMap[String,String]): scala.xml.Node ; - - final def doGet(out: HttpOutputStream, info: HashMap[String,String]): Unit= { - try{ - out.write( doGetXML( info ).toString() ); - } - catch { - case sException:ServletException => ReturnException( sException.returnType(),sException.returnInfo()); - case ex:Exception => ReturnException(30,""); - } - } - - final def ReturnException(code:int, detail :String):unit={ - var info = new HashMap[String,String]; - info.update("code", SERVLET.getCodeMessage(code) ); - info.update("detail", detail); - new ExcepServlet().doGet(output, info); - return null; - - } -} - - - - - - - - - - - - - - - - - - - - - diff --git a/sources/scala/tools/servletEngine/ServletException.scala b/sources/scala/tools/servletEngine/ServletException.scala deleted file mode 100644 index 4f9826d679..0000000000 --- a/sources/scala/tools/servletEngine/ServletException.scala +++ /dev/null @@ -1,13 +0,0 @@ -package scala.tools.servletEngine; -import java.io._; -import java.util._; -import java.lang.Math._; -import scala.xml._; -class ServletException(typ:int,info:String) extends Exception{ - def returnType():int={typ;} - def returnInfo():String={info;} - -} - - - |