On Mon, Dec 28, 2009 at 12:36 PM, Axel Rauschmayer axel@rauschma.de wrote:
I think ABCL would make an excellent Ajax server. As such, it would have to support json-rpc. Any suggestions as to how to make this happen?
I think I can give you some suggestions, but keep in mind that I have never used abcl in a web context, so other people might know better.
The first part is obviously the server, where the two choices that I can see are Hunchentoot and a servlet container such as Tomcat. In the latter case, I would expect to use a technique like abcl-web (which seems a little bit complicated, but doable).
I believe Hunchentoot does not currently work on abcl, since it depends on flexi-streams which depends on trivial-gray-streams which iirc doesn't support abcl. So the other option seems the most viable at the moment. Why is it complicated? Just write a dummy servlet that dispatches every request to a Lisp function. You can dispatch different URLs to different functions using the servlet container (i.e. mapping the same servlet class to different URL patterns), or if you want more flexibility do the dispatch in Lisp, but in that case you'll need to write the dispatch code yourself, or maybe adapt it from Hunchentoot. You might also want to write some glue code to access the request, response, and session objects in a more Lispy way.
The second part is the JSON parsing. How would I do that? Via CL-JSON? Via Yason? Via a Java library?
I can't recommend a JSON library, but if there are mature CL libraries, it's probably better to use one of them instead of a Java library.
Sorry for these newbie questions. I’m just getting started with Common Lisp and ABCL.
No reason to be sorry, those aren't really newbie questions, and anyway, new users are welcome :)
hth, Alessio Stalla