changeset 568:aa17ad66a370 0.11

fix http response headers
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 07 Jul 2015 19:32:34 -0600
parents 6c00b8a59240
children c9f04d62e132
files http/src/luan/modules/http/Http.luan http/src/luan/modules/http/HttpServicer.java
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
diff -r 6c00b8a59240 -r aa17ad66a370 http/src/luan/modules/http/Http.luan
--- a/http/src/luan/modules/http/Http.luan	Sun Jul 05 19:29:56 2015 -0600
+++ b/http/src/luan/modules/http/Http.luan	Tue Jul 07 19:32:34 2015 -0600
@@ -102,11 +102,17 @@
 			HttpServicer.removeCookie(M.request.java,this.java,name,domain)
 		end
 
+		function this.set()
+			HttpServicer.setResponse(this,this.java)
+		end
+
 		function this.text_writer()
+			this.set()
 			return IoLuan.textWriter(this.java.getWriter())
 		end
 
 		function this.binary_writer()
+			this.set()
 			return IoLuan.binaryWriter(this.java.getOutputStream())
 		end
 	end
diff -r 6c00b8a59240 -r aa17ad66a370 http/src/luan/modules/http/HttpServicer.java
--- a/http/src/luan/modules/http/HttpServicer.java	Sun Jul 05 19:29:56 2015 -0600
+++ b/http/src/luan/modules/http/HttpServicer.java	Tue Jul 07 19:32:34 2015 -0600
@@ -5,8 +5,6 @@
 import java.io.PrintWriter;
 import java.io.IOException;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.AbstractMap;
 import java.util.Set;
 import java.util.List;
 import java.util.ArrayList;
@@ -157,12 +155,11 @@
 		module.rawPut("response",responseTbl);
 
 		luan.call(fn,"<http>");
-		setResponse(module,response);
+//		setResponse(module,response);
 		return true;
 	}
 
-	private static void setResponse(LuanTable module,HttpServletResponse response) throws LuanException {
-		LuanTable responseTbl = (LuanTable)module.rawGet("response");
+	public static void setResponse(LuanTable responseTbl,HttpServletResponse response) throws LuanException {
 		int status = Luan.asInteger(responseTbl.rawGet("status"));
 		response.setStatus(status);
 		LuanTable responseHeaders = (LuanTable)responseTbl.rawGet("headers");