Communicating between HTTP server/client pair

You have problems, and we're glad to hear them. Explain the problem, what you have tried, and where you got stuck.
Feel free to share a little info on yourself and the course.
Forum rules
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.
Post Reply
snowfarthing
Posts: 2
Joined: Mon Sep 12, 2011 9:12 am

Communicating between HTTP server/client pair

Post by snowfarthing » Thu Jan 10, 2013 11:19 pm

About three months ago, I was looking for work; about two months ago, I accepted a position; then, about a month ago, one of the companies I applied to sent me "homework" as part of their interview process. I'm supposed to write a Python REST interface for a basic database. Since I'm not seriously considering the company for employment, I decided to accept the assignment on my terms: I decided to do the assignment in Common Lisp. :twisted:

Since the homework uses all four REST verbs (GET, PUT, DELETE, and POST), I discovered that I had to use "s-http-server" to implement the server, and to use "s-http-client" to communicate with the server. It took a while for me to get used to it (and I have yet to figure out how to serve static pages)...and I have run into another hurdle that I haven't been able to figure out: how do I transfer content--particularly forms--between these two servers?

I tried setting "content" to the JSON object I was attempting to send to the server...but I couldn't figure out how to read that content from the server's side. While I could add the object to the URL, that doesn't seem like the best solution for passing JSON objects; besides, doing so just seems...wrong...somehow. Besides being something I ought to be able to do via forms, somehow, I sense that the solution shouldn't clutter up the URL with such things.

Thus, I wonder: what do I need to do, to pass a JSON object through the client, and then to extract it, once it gets to the server?

Perhaps I need to extend one or both of "s-http-server" and "s-http-client" to do this...if so, where should I begin?

Any help on this would be *greatly* appreciated!

(For the record, although I suppose I'd be "better off" doing this in Python, I'm glad I chose Common Lisp: I got to learn the magic of Quicklisp; while the libraries may leave a bit to be desired, I am nonetheless getting more familiar with what's available for Common Lisp, and how well they work; and I'm learning more about RESTful architectures than I otherwise would have learned, I think!)

Post Reply