Mercurial Hosting > luan
changeset 467:f86bf532f87c
improve LuanServlet to allow for URL mapping
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 08 May 2015 12:10:53 -0600 |
parents | 55a86fc4701b |
children | 9b51e2413cab |
files | web/src/luan/modules/web/LuanServlet.java |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
diff -r 55a86fc4701b -r f86bf532f87c web/src/luan/modules/web/LuanServlet.java --- a/web/src/luan/modules/web/LuanServlet.java Fri May 08 11:15:53 2015 -0600 +++ b/web/src/luan/modules/web/LuanServlet.java Fri May 08 12:10:53 2015 -0600 @@ -22,14 +22,19 @@ this(uriPrefix,LuanState.newInstance()); } - protected void service(HttpServletRequest request,HttpServletResponse response) + @Override protected void service(HttpServletRequest request,HttpServletResponse response) throws IOException { String path = request.getRequestURI(); + service(request,response,path); + } + + public void service(HttpServletRequest request,HttpServletResponse response,String path) + throws IOException + { if( !path.endsWith(".luan") ) throw new RuntimeException("'"+path+"' doesn't end with '.luan'"); String uri = uriPrefix + path.substring(0,path.length()-5); -//System.out.println("qqqqqqqqqqqqqqqqqqq "+uri); try { if( !HttpServicer.service(luan,request,response,uri) ) response.sendError(HttpServletResponse.SC_NOT_FOUND);