Permalink
Browse files

server is work, read first line from HTTP request

  • Loading branch information...
1 parent 2cbbf4b commit d13eba4ff92fb2a8748d6669d41ba4e6201803f4 @isqad committed Apr 17, 2013
Showing with 7 additions and 8 deletions.
  1. +1 −0 .gitignore
  2. +6 −8 Server.scala
View
@@ -0,0 +1 @@
+/httpserver
View
@@ -22,7 +22,8 @@ class RequestHandler extends Actor {
println("Received message from " + client.getInetAddress() + ":" + client.getPort())
//Считываем заголовки запроса
var is:InputStream = client.getInputStream()
- var buffer:BufferedReader = new BufferedReader(is)
+
+ var buffer:BufferedReader = new BufferedReader(new InputStreamReader(is))
println("First header Line: " + buffer.readLine())
}
case _ => println("Request error, discarded!")
@@ -47,12 +48,9 @@ class HttpServer(port: Int, address: InetAddress) extends Actor {
}
-object Server {
- def main(args: Array[String]) {
- var address:InetAddress = InetAddress.getByName("127.0.0.1")
-
- var server:HttpServer = new HttpServer(1234, address)
- server.start()
+object Server extends App {
+ var address:InetAddress = InetAddress.getByName("127.0.0.1")
- }
+ var server:HttpServer = new HttpServer(1234, address)
+ server.start()
}

0 comments on commit d13eba4

Please sign in to comment.