changeset 223:a9fe265dbac3

upgrade to jetty 8 git-svn-id: https://luan-java.googlecode.com/svn/trunk@224 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 21 Jul 2014 06:38:01 +0000
parents b76fcb72d97d
children 05eb2837ddbf
files web/ext/jetty-continuation-7.6.0.v20120127.jar web/ext/jetty-continuation-8.1.15.v20140411.jar web/ext/jetty-http-7.6.0.v20120127.jar web/ext/jetty-http-8.1.15.v20140411.jar web/ext/jetty-io-7.6.0.v20120127.jar web/ext/jetty-io-8.1.15.v20140411.jar web/ext/jetty-server-7.6.0.v20120127.jar web/ext/jetty-server-8.1.15.v20140411.jar web/ext/jetty-util-7.6.0.v20120127.jar web/ext/jetty-util-8.1.15.v20140411.jar web/ext/servlet-api-2.5.jar web/ext/servlet-api-3.0.jar web/src/luan/modules/web/HttpLuan.java
diffstat 13 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
Binary file web/ext/jetty-continuation-7.6.0.v20120127.jar has changed
Binary file web/ext/jetty-continuation-8.1.15.v20140411.jar has changed
Binary file web/ext/jetty-http-7.6.0.v20120127.jar has changed
Binary file web/ext/jetty-http-8.1.15.v20140411.jar has changed
Binary file web/ext/jetty-io-7.6.0.v20120127.jar has changed
Binary file web/ext/jetty-io-8.1.15.v20140411.jar has changed
Binary file web/ext/jetty-server-7.6.0.v20120127.jar has changed
Binary file web/ext/jetty-server-8.1.15.v20140411.jar has changed
Binary file web/ext/jetty-util-7.6.0.v20120127.jar has changed
Binary file web/ext/jetty-util-8.1.15.v20140411.jar has changed
Binary file web/ext/servlet-api-2.5.jar has changed
Binary file web/ext/servlet-api-3.0.jar has changed
--- a/web/src/luan/modules/web/HttpLuan.java	Mon Jul 21 02:23:05 2014 +0000
+++ b/web/src/luan/modules/web/HttpLuan.java	Mon Jul 21 06:38:01 2014 +0000
@@ -172,13 +172,6 @@
 		tbl.put("java",response);
 		add( tbl, "send_redirect", String.class );
 		add( tbl, "send_error", Integer.TYPE, String.class );
-		tbl.put( "contains_header", new LuanJavaFunction(
-			HttpServletResponse.class.getMethod("containsHeader",String.class), response
-		) );
-		tbl.put( "set_header", new LuanJavaFunction(
-			HttpServletResponse.class.getMethod("setHeader",String.class,String.class), response
-		) );
-/*
 		LuanTable headers = new NameTable() {
 
 			@Override Object get(String name) {
@@ -189,12 +182,27 @@
 				return response.getHeaderNames().iterator();
 			}
 
+			@Override public Object put(Object key,Object val) {
+				if( !(key instanceof String) )
+					throw new IllegalArgumentException("key must be string for headers table");
+				String name = (String)key;
+				if( val instanceof String ) {
+					response.setHeader(name,(String)val);
+					return null;
+				}
+				Integer i = Luan.asInteger(val);
+				if( i != null ) {
+					response.setIntHeader(name,i);
+					return null;
+				}
+				throw new IllegalArgumentException("value must be string or integer for headers table");
+			}
+
 			@Override protected String type() {
 				return "response.headers-table";
 			}
 		};
 		tbl.put( "headers", headers );
-*/
 		tbl.put( "set_content_type", new LuanJavaFunction(
 			HttpServletResponse.class.getMethod("setContentType",String.class), response
 		) );