Mercurial Hosting > luan
comparison web/src/luan/modules/web/HttpServicer.java @ 436:52a6295e92c9
support old jetty
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 03 May 2015 22:29:18 -0600 |
parents | c6bcb8859b93 |
children | bf5e62a9090c |
comparison
equal
deleted
inserted
replaced
435:5b36f663a1b8 | 436:52a6295e92c9 |
---|---|
18 import javax.servlet.http.Cookie; | 18 import javax.servlet.http.Cookie; |
19 import javax.servlet.http.HttpServletRequest; | 19 import javax.servlet.http.HttpServletRequest; |
20 import javax.servlet.http.HttpServletResponse; | 20 import javax.servlet.http.HttpServletResponse; |
21 import javax.servlet.http.HttpSession; | 21 import javax.servlet.http.HttpSession; |
22 import javax.servlet.http.Part; | 22 import javax.servlet.http.Part; |
23 import org.slf4j.Logger; | |
24 import org.slf4j.LoggerFactory; | |
23 import org.eclipse.jetty.util.MultiPartInputStream; | 25 import org.eclipse.jetty.util.MultiPartInputStream; |
24 import luan.Luan; | 26 import luan.Luan; |
25 import luan.LuanState; | 27 import luan.LuanState; |
26 import luan.LuanFunction; | 28 import luan.LuanFunction; |
27 import luan.LuanElement; | 29 import luan.LuanElement; |
37 import luan.modules.TableLuan; | 39 import luan.modules.TableLuan; |
38 import luan.modules.Utils; | 40 import luan.modules.Utils; |
39 | 41 |
40 | 42 |
41 public final class HttpServicer { | 43 public final class HttpServicer { |
44 private static final Logger logger = LoggerFactory.getLogger(HttpServicer.class); | |
42 | 45 |
43 public static boolean service(LuanState luan,HttpServletRequest request,HttpServletResponse response,String modName) | 46 public static boolean service(LuanState luan,HttpServletRequest request,HttpServletResponse response,String modName) |
44 throws LuanException | 47 throws LuanException |
45 { | 48 { |
46 LuanFunction fn; | 49 LuanFunction fn; |
323 HttpServletResponse.class.getMethod( "setCharacterEncoding", String.class ), response | 326 HttpServletResponse.class.getMethod( "setCharacterEncoding", String.class ), response |
324 ) ); | 327 ) ); |
325 add( tbl, "text_writer" ); | 328 add( tbl, "text_writer" ); |
326 add( tbl, "set_cookie", String.class, String.class, Boolean.TYPE, String.class ); | 329 add( tbl, "set_cookie", String.class, String.class, Boolean.TYPE, String.class ); |
327 add( tbl, "remove_cookie", String.class, String.class ); | 330 add( tbl, "remove_cookie", String.class, String.class ); |
328 getters.rawPut( "status", new LuanJavaFunction( | 331 try { |
329 HttpServletResponse.class.getMethod( "getStatus" ), response | 332 getters.rawPut( "status", new LuanJavaFunction( |
330 ) ); | 333 HttpServletResponse.class.getMethod( "getStatus" ), response |
334 ) ); | |
335 } catch(NoSuchMethodException e) { | |
336 logger.info("please upgrade jetty"); | |
337 } | |
331 setters.rawPut( "status", new LuanJavaFunction( | 338 setters.rawPut( "status", new LuanJavaFunction( |
332 HttpServletResponse.class.getMethod( "setStatus", Integer.TYPE ), response | 339 HttpServletResponse.class.getMethod( "setStatus", Integer.TYPE ), response |
333 ) ); | 340 ) ); |
334 return tbl; | 341 return tbl; |
335 } | 342 } |