changeset 216:a1b142f9c5c0

make Utils.toUrl() check for "index.html" or "index.html.luan" in dirs for jars (hack) git-svn-id: https://luan-java.googlecode.com/svn/trunk@217 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 14 Jul 2014 06:11:55 +0000
parents b2304de4579b
children a608066395c5
files core/src/luan/modules/Utils.java dist/luan-core-trunk.jar dist/luan-logging-trunk.jar dist/luan-web-trunk.jar web/src/luan/modules/web/Web_server.luan
diffstat 5 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/modules/Utils.java	Fri Jul 11 23:13:15 2014 +0000
+++ b/core/src/luan/modules/Utils.java	Mon Jul 14 06:11:55 2014 +0000
@@ -75,6 +75,18 @@
 			if( path.contains("//") )
 				return null;
 			URL url = ClassLoader.getSystemResource(path);
+			if( url==null && path.endsWith("/") ) {
+				url = ClassLoader.getSystemResource(path+"index.html");
+				if( url==null )
+					url = ClassLoader.getSystemResource(path+"index.html.luan");
+				if( url != null ) {
+					try {
+						url = new URL(url,".");
+					} catch(MalformedURLException e) {
+						throw new RuntimeException(e);
+					}
+				}
+			}
 			return url==null ? null : url;
 		}
 		try {
Binary file dist/luan-core-trunk.jar has changed
Binary file dist/luan-logging-trunk.jar has changed
Binary file dist/luan-web-trunk.jar has changed
--- a/web/src/luan/modules/web/Web_server.luan	Fri Jul 11 23:13:15 2014 +0000
+++ b/web/src/luan/modules/web/Web_server.luan	Mon Jul 14 06:11:55 2014 +0000
@@ -72,7 +72,7 @@
 	Http.dir = dir
 	Package.path = dir.."?.luan;java:luan/modules/?.luan"
 	authentication_handler.setPassword(private_password)
-	resource_handler.setResourceBase(Io.File(dir).to_string())
+	resource_handler.setResourceBase(Io.File(dir.."/").to_string())
 	resource_handler.setWelcomeFiles {welcome_file}
 	luan_handler.setWelcomeFile(welcome_file)
 	local server = Server.new(port)