Mercurial Hosting > luan
changeset 252:3896138955b1
web testing...
git-svn-id: https://luan-java.googlecode.com/svn/trunk@253 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 20 Oct 2014 02:23:00 +0000 |
parents | 705d14f4d8ee |
children | dddf4e85bfe4 |
files | lucene/src/luan/modules/lucene/LuceneIndex.java web/src/luan/modules/web/Http.luan |
diffstat | 2 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lucene/src/luan/modules/lucene/LuceneIndex.java Sun Oct 19 03:38:47 2014 +0000 +++ b/lucene/src/luan/modules/lucene/LuceneIndex.java Mon Oct 20 02:23:00 2014 +0000 @@ -93,6 +93,17 @@ return new LuceneSnapshot(this); } + public void delete_all() throws IOException { + writeLock.lock(); + try { + writer.deleteAll(); + writer.commit(); + id = idLim = 0; + } finally { + writeLock.unlock(); + } + } + private long id = 0; private long idLim = 0; @@ -184,6 +195,7 @@ add( tbl, "backup", LuanState.class, String.class ); add( tbl, "Writer", LuanState.class, LuanFunction.class ); add( tbl, "Searcher", LuanState.class, LuanFunction.class ); + add( tbl, "delete_all" ); } catch(NoSuchMethodException e) { throw new RuntimeException(e); }
--- a/web/src/luan/modules/web/Http.luan Sun Oct 19 03:38:47 2014 +0000 +++ b/web/src/luan/modules/web/Http.luan Mon Oct 20 02:23:00 2014 +0000 @@ -16,11 +16,15 @@ return Table.concat(result) end + cookies = cookies or {} + request = { - cookies = {} + parameters = {}; } + request.cookies = cookies response = { + text_writer = function() result = {} return { @@ -31,6 +35,15 @@ end; } end; + + set_cookie = function(name,value) + cookies[name] = value + end; + + send_redirect = function(url) + response.redirect = url + end; + } end