So lately I've been looking into Clojure, and I love the language. I would like to see if I can make a small web application in it, just to challenge myself. However, I have absolutely no experience setting up any Java-related web applications. In fact, I don't really have much experience with Java at all. Where do I start? I have lots of experience with Apache and the LAMP stack, and I know on Apache I would just use Fast-CGI in most cases, but I don't know the equivalent in the Java world (if there is one).
Basically, I just need help with setting up the server and getting it started. I understand (somewhat) how to deploy a pure Java application, but what about a pure Clojure application? How does that work? I guess, coming from a world where all web applications are written in scripting languages, this is all new to me.
Oh, and by the way, I don't want to use a Clojure framework such as Compojure. That would defeat the learning part of this.
Thanks in advance.
Yes, Clojure is great for web development. Here are the main reasons: JVM deployment options. Clojure can deploy anywhere Java can.
I'd recommend you start by learning the Servlet-API, which backs all things related to HTTP-requests and responses in the Java world. HttpServletRequest
and HttpServletResponse
cover a lot of ground here. Jetty is a nice choice here; there's a good introduction about Clojure and Jetty at http://robert.zubek.net/blog/2008/04/26/clojure-web-server/ (using Jetty 6).
That being said, Compojure's basic model is pretty low-level too: it just wraps the requests and responses in Clojure-datastructures, but you are still responsible for all routing, generating the right response codes. generating an ETag
etc., which is sometimes more low-level stuff than with a LAMP-stack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With