[Armedbear-devel] handling dependencies

Eduardo Bellani ebellani at gmail.com
Sun Aug 17 20:37:24 UTC 2014

Hash: SHA1

Hello guys.

This is my first post on the list, and beg your forgiveness if this
question was already answered, but alas, my search-fu was incapable
of finding anything that could have helped me.

Here is my situation:

I am trying to build a servlet using ABCL. The servlet is a middleware
that will expose an API, consume JSON, and return JSON. I will also
store some data into a postgres RDBMS.

I've used the google-app-engine example as a basis to build a skeleton
of my app, with a Java class providing a proxy for the servlet. If I
don't use any dependencies on my project, everything runs ok. My
problem is that I have the following system descriptor:

(asdf:defsystem #:abcl-servlet
  :serial t
  :description "An example of a servlet using the ABCL stack."
  :author  "Eduardo Bellani <ebellani at gmail.com>"
  :license "Beerware v. 42"
  :depends-on (:jsown
  :components ((:module :src
                        :components ((:file "package")
                                     (:file "servlet-interface")))))

As you can see, I have some dependencies on my code. Dependencies
which I must load before my packages can run. I'm wondering how I can
load this dependencies without explicitly coding the load
calls. FWIWI, the java proxy class is here:

public class ServletProxy extends HttpServlet {

    static private Symbol  doGet       = null;
    static private Symbol  doPost      = null;
    static private Symbol  doDestroy   = null;
    static private Object  lock        = new Object();
    static private boolean initialized = false;

    private static void doWithStreamsBound(Symbol              whatToDo,
                                           HttpServletRequest  req,
                                           HttpServletResponse resp)
throws IOException {
        LispThread currentThread = LispThread.currentThread();
        SpecialBindingsMark mark = currentThread.markSpecialBindings();
                                  new Stream(Symbol.SYSTEM_STREAM,
                                             Symbol.CHARACTER, false));
                                  new Stream(Symbol.SYSTEM_STREAM,
                                             Symbol.CHARACTER, false));
        try {
        } finally {

     * Initialize the lisp interpreter that the symbols that will be
     * called on the lisp servlet interface. Not surprisingly, these
     * symbols mirror the HttpServlet interface. This is a result of
     * this class being only a proxy for the internal lisp system.
    public void init(ServletConfig config) throws ServletException {
        // No need for any external usage of theInit
        Symbol theInit = null;

        doGet     = Lisp.internInPackage("DO-GET",   "SERVLET-INTERFACE");
        doPost    = Lisp.internInPackage("DO-POST",  "SERVLET-INTERFACE");
        theInit   = Lisp.internInPackage("INIT",     "SERVLET-INTERFACE");
        theDestroy = Lisp.internInPackage("DESTROY", "SERVLET-INTERFACE");

    public void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
        ServletProxy.doWithStreamsBound(doGet, req, resp);

I'm planning to write down a tutorial that covers building a web app
in ABCL from scratch up to a running servlet that touches a DB and
returns JSON, so I want to know the best way to do those things.

Thanks for the attention, and please let me know if you guys have any
questions or pointers.

See you.
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/


Armedbear-devel mailing list
Armedbear-devel at common-lisp.net

More information about the armedbear-devel mailing list