Line | |
---|
1 | package abcl_ae; |
---|
2 | |
---|
3 | import java.io.IOException; |
---|
4 | import javax.servlet.http.*; |
---|
5 | import javax.servlet.*; |
---|
6 | |
---|
7 | import org.armedbear.lisp.Interpreter; |
---|
8 | import org.armedbear.lisp.LispThread; |
---|
9 | import org.armedbear.lisp.Lisp; |
---|
10 | import org.armedbear.lisp.Symbol; |
---|
11 | import org.armedbear.lisp.SpecialBinding; |
---|
12 | import org.armedbear.lisp.SpecialBindingsMark; |
---|
13 | import org.armedbear.lisp.Load; |
---|
14 | import org.armedbear.lisp.Stream; |
---|
15 | |
---|
16 | public class HelloWorldServlet extends HttpServlet { |
---|
17 | |
---|
18 | static private Symbol doGet = null; |
---|
19 | |
---|
20 | public void init() throws ServletException { |
---|
21 | AbclInit.init(); |
---|
22 | doGet = Lisp.internInPackage("DO-GET", "FIRST-SERVLET"); |
---|
23 | } |
---|
24 | |
---|
25 | |
---|
26 | public void doGet(HttpServletRequest req, HttpServletResponse resp) |
---|
27 | throws IOException { |
---|
28 | |
---|
29 | LispThread currentThread = LispThread.currentThread(); |
---|
30 | |
---|
31 | SpecialBindingsMark mark = currentThread.markSpecialBindings(); |
---|
32 | currentThread.bindSpecial( |
---|
33 | Symbol.STANDARD_OUTPUT, |
---|
34 | new Stream(Symbol.SYSTEM_STREAM, resp.getOutputStream(), |
---|
35 | Symbol.CHARACTER, false)); |
---|
36 | |
---|
37 | try { |
---|
38 | currentThread.execute(doGet); |
---|
39 | } finally { |
---|
40 | currentThread.resetSpecialBindings(mark); |
---|
41 | } |
---|
42 | } |
---|
43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.