changeset 1605:ef9d96aeb541

use FileHandler in WebHandler
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 17 Apr 2021 18:11:37 -0600
parents 8a7519dee55c
children 7c7f28c724e8
files src/goodjava/webserver/Response.java src/luan/host/WebHandler.java src/luan/modules/http/Server.luan
diffstat 3 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/goodjava/webserver/Response.java	Fri Apr 16 19:19:39 2021 -0600
+++ b/src/goodjava/webserver/Response.java	Sat Apr 17 18:11:37 2021 -0600
@@ -13,7 +13,7 @@
 	public volatile Status status = Status.OK;
 	public final Map<String,Object> headers = Collections.synchronizedMap(new LinkedHashMap<String,Object>());
 	{
-		headers.put("server","Goodjava");
+		headers.put("server","goodjava");
 	}
 	private static final Body empty = new Body(0,new InputStream(){
 		public int read() { return -1; }
--- a/src/luan/host/WebHandler.java	Fri Apr 16 19:19:39 2021 -0600
+++ b/src/luan/host/WebHandler.java	Sat Apr 17 18:11:37 2021 -0600
@@ -63,10 +63,11 @@
 			initLuan(luan,dirStr,domain);
 			LuanHandler luanHandler = new LuanHandler(luan,domain);
 
+			FileHandler fileHandler = new FileHandler(dirStr+"/site/");
+			Handler handler = new ListHandler( luanHandler, fileHandler );
+			handler = new IndexHandler(handler);
+			DirHandler dirHandler = new DirHandler(fileHandler);
 			Handler notFoundHander = new NotFound(luanHandler);
-			Handler handler = new IndexHandler(luanHandler);
-			FileHandler fileHandler = new FileHandler(dirStr+"/site/");
-			DirHandler dirHandler = new DirHandler(fileHandler);
 			handler = new ListHandler( handler, dirHandler, notFoundHander );
 			handler = new ContentTypeHandler(handler);
 			handler = new SafeHandler(handler);
--- a/src/luan/modules/http/Server.luan	Fri Apr 16 19:19:39 2021 -0600
+++ b/src/luan/modules/http/Server.luan	Sat Apr 17 18:11:37 2021 -0600
@@ -65,11 +65,11 @@
 	Server.init_dir(dir)
 	local dir_path = match(Http.dir,"^file:(.*)$") or error "server dir must be scheme 'file:'"
 	local file_handler = FileHandler.new(dir_path)
+	local luan_handler = LuanHandler.new()
+	local handler = ListHandler.new( luan_handler, file_handler )
+	handler = IndexHandler.new(handler)
 	local dir_handler = DirHandler.new(file_handler)
-	local luan_handler = LuanHandler.new()
 	local not_found_hander = NotFound.new(luan_handler)
-	local handler = ListHandler.new( file_handler, luan_handler )
-	handler = IndexHandler.new(handler)
 	handler = ListHandler.new( handler, dir_handler, not_found_hander )
 	handler = ContentTypeHandler.new(handler)
 	handler = SafeHandler.new(handler)