Mercurial Hosting > luan
comparison web/src/luan/modules/web/web_run.luan @ 283:b669cdaf54b7
add URL post;
add Http.request.query_string;
add web_run.form();
git-svn-id: https://luan-java.googlecode.com/svn/trunk@284 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Tue, 02 Dec 2014 03:34:04 +0000 |
parents | 82a3ebcfbafa |
children | 582e8db4cdb6 |
comparison
equal
deleted
inserted
replaced
282:38bd29e59a6e | 283:b669cdaf54b7 |
---|---|
16 print(i,line) | 16 print(i,line) |
17 i = i + 1 | 17 i = i + 1 |
18 end | 18 end |
19 end | 19 end |
20 | 20 |
21 local function form() %> | |
22 <html> | |
23 <body> | |
24 <form action="run" method="post"> | |
25 <input type="hidden" name="content_type" value="text/plain" /> | |
26 <input type="submit" value="Execute Luan code below"> | |
27 <br /> | |
28 <textarea name="code" rows="30" cols="90" wrap="off"> | |
29 </textarea> | |
30 </form> | |
31 </body> | |
32 </html> | |
33 <% end | |
34 | |
21 function service() | 35 function service() |
36 Io.stdout = Http.response.text_writer() | |
37 local code = Http.request.parameters.code | |
38 if code == nil then | |
39 form() | |
40 return | |
41 end | |
22 local content_type = Http.request.parameters.content_type | 42 local content_type = Http.request.parameters.content_type |
23 if content_type ~= nil then | 43 if content_type ~= nil then |
24 Http.response.content_type = content_type | 44 Http.response.content_type = content_type |
25 end | 45 end |
26 Io.stdout = Http.response.text_writer() | |
27 local code = Http.request.parameters.code | |
28 local env = { | 46 local env = { |
29 request = Http.request; | 47 request = Http.request; |
30 response = Http.response; | 48 response = Http.response; |
31 } | 49 } |
32 try | 50 try |