Mercurial Hosting > luan
changeset 477:b8ddd55c9b11
delete LuanExitException
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 11 May 2015 14:36:33 -0600 |
parents | cd22e4694ea3 |
children | eb6d90fb0b5c |
files | core/src/luan/LuanExitException.java core/src/luan/LuanJavaFunction.java web/src/luan/modules/web/HttpServicer.java |
diffstat | 3 files changed, 7 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
diff -r cd22e4694ea3 -r b8ddd55c9b11 core/src/luan/LuanExitException.java --- a/core/src/luan/LuanExitException.java Sun May 10 22:41:00 2015 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -package luan; - - -public final class LuanExitException extends RuntimeException {}
diff -r cd22e4694ea3 -r b8ddd55c9b11 core/src/luan/LuanJavaFunction.java --- a/core/src/luan/LuanJavaFunction.java Sun May 10 22:41:00 2015 -0600 +++ b/core/src/luan/LuanJavaFunction.java Mon May 11 14:36:33 2015 -0600 @@ -94,8 +94,6 @@ throw (Error)cause; if( cause instanceof LuanException ) throw (LuanException)cause; - if( cause instanceof LuanExitException ) - throw (LuanExitException)cause; throw luan.exception(cause); } catch(InstantiationException e) { throw new RuntimeException(e);
diff -r cd22e4694ea3 -r b8ddd55c9b11 web/src/luan/modules/web/HttpServicer.java --- a/web/src/luan/modules/web/HttpServicer.java Sun May 10 22:41:00 2015 -0600 +++ b/web/src/luan/modules/web/HttpServicer.java Mon May 11 14:36:33 2015 -0600 @@ -31,7 +31,6 @@ import luan.LuanTable; import luan.LuanMeta; import luan.LuanJavaFunction; -import luan.LuanExitException; import luan.LuanPropertyMeta; import luan.DeepCloner; import luan.modules.PackageLuan; @@ -89,11 +88,7 @@ throw new RuntimeException(e); } - try { - luan.call(fn,"<http>"); - } catch(LuanExitException e) { -// System.out.println("caught LuanExitException"); - } + luan.call(fn,"<http>"); return true; } @@ -275,8 +270,12 @@ LuanTable getters = LuanPropertyMeta.INSTANCE.getters(tbl); LuanTable setters = LuanPropertyMeta.INSTANCE.setters(tbl); tbl.rawPut("java",response); - add( tbl, "send_redirect", String.class ); - add( tbl, "send_error", Integer.TYPE, String.class ); + tbl.rawPut( "send_redirect", new LuanJavaFunction( + HttpServletResponse.class.getMethod( "sendRedirect", String.class ), response + ) ); + tbl.rawPut( "send_error", new LuanJavaFunction( + HttpServletResponse.class.getMethod( "sendError", Integer.TYPE, String.class ), response + ) ); LuanTable headers = new NameMeta() { @Override Object get(String name) { @@ -393,20 +392,6 @@ return request.getParameterValues(name); } - public void send_redirect(String redirectUrl) - throws IOException - { - response.sendRedirect(redirectUrl); - throw new LuanExitException(); - } - - public void send_error(int code,String text) - throws IOException - { - response.sendError(code, text); - throw new LuanExitException(); - } - public void set_cookie(String name,String value,boolean isPersistent, String domain) { setCookie(request,response,name,value,isPersistent,domain); }