source: branches/streams/abcl/examples/google-app-engine/src/abcl_ae/HelloWorldServlet.java

Last change on this file was 12729, checked in by Mark Evenson, 15 years ago

Restore buildable state.

File size: 1.1 KB
Line 
1package abcl_ae;
2
3import java.io.IOException;
4import javax.servlet.http.*;
5import javax.servlet.*;
6
7import org.armedbear.lisp.Interpreter;
8import org.armedbear.lisp.LispThread;
9import org.armedbear.lisp.Lisp;
10import org.armedbear.lisp.Symbol;
11import org.armedbear.lisp.SpecialBinding;
12import org.armedbear.lisp.SpecialBindingsMark;
13import org.armedbear.lisp.Load;
14import org.armedbear.lisp.Stream;
15
16public 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.