changeset 181:5d2cb8c1f844

add web logging git-svn-id: https://luan-java.googlecode.com/svn/trunk@182 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Tue, 24 Jun 2014 07:16:53 +0000
parents 5351374efb6d
children e6d6596a8bcc
files core/src/luan/impl/LuanParser.java dist/luan-core-trunk.jar dist/luan-web-trunk.jar web/src/luan/modules/web/Web_server.luan
diffstat 4 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/impl/LuanParser.java	Tue Jun 24 04:26:56 2014 +0000
+++ b/core/src/luan/impl/LuanParser.java	Tue Jun 24 07:16:53 2014 +0000
@@ -1023,11 +1023,13 @@
 			builder.add( new ConstExpr(s) );
 			return true;
 		}
+/*
 		Expressions exps = TemplateExpressions(in);
 		if( exps != null ) {
 			builder.add(exps);
 			return true;
 		}
+*/
 		return false;
 	}
 
Binary file dist/luan-core-trunk.jar has changed
Binary file dist/luan-web-trunk.jar has changed
--- a/web/src/luan/modules/web/Web_server.luan	Tue Jun 24 04:26:56 2014 +0000
+++ b/web/src/luan/modules/web/Web_server.luan	Tue Jun 24 07:16:53 2014 +0000
@@ -1,9 +1,12 @@
 import "Java"
 
 import "org.eclipse.jetty.server.Server"
+import "org.eclipse.jetty.server.NCSARequestLog"
 import "org.eclipse.jetty.server.handler.DefaultHandler"
 import "org.eclipse.jetty.server.handler.HandlerList"
+import "org.eclipse.jetty.server.handler.HandlerCollection"
 import "org.eclipse.jetty.server.handler.ResourceHandler"
+import "org.eclipse.jetty.server.handler.RequestLogHandler"
 import "org.eclipse.jetty.server.session.SessionHandler"
 import "web/Http"
 
@@ -11,14 +14,22 @@
 port = 8080
 
 
-resource_handler = ResourceHandler.new()
-
 session_handler = SessionHandler.new()
 
 luan_handler = Http.new_luan_handler()
 
+resource_handler = ResourceHandler.new()
+
 handlers = HandlerList.new()
-handlers.setHandlers { resource_handler, session_handler, luan_handler, DefaultHandler.new() }
+handlers.setHandlers { session_handler, luan_handler, resource_handler, DefaultHandler.new(), log_handler }
+
+log = NCSARequestLog.new()
+log.setExtended(false)
+log_handler = RequestLogHandler.new()
+log_handler.setRequestLog(log)
+
+local hc = HandlerCollection.new()
+hc.setHandlers { handlers, log_handler }
  
 
 function serve(dir)
@@ -26,6 +37,6 @@
 	Package.path = dir.."?.luan;java:luan/modules/?.luan"
 	resource_handler.setResourceBase(dir)
 	local server = Server.new(port)
-	server.setHandler(handlers);
+	server.setHandler(hc);
 	server.start()
 end