Browse files

Doc and example tweaks.

  • Loading branch information...
1 parent 7271607 commit f2f42293e86198bb2a1c6411819ded5d3d82cd35 @mmcgrana committed Feb 23, 2010
@@ -1,4 +1,4 @@
-Copyright (c) 2009 Mark McGranaghan
+Copyright (c) 2009-2010 Mark McGranaghan
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@@ -18,12 +18,12 @@ A Ring handler:
Adding simple middleware:
- (defn with-upcase [app]
+ (defn wrap-upcase [app]
(fn [req]
(let [orig-resp (app req)]
(assoc orig-resp :body (.toUpperCase (:body orig-resp))))))
- (def upcase-app (with-upcase app))
+ (def upcase-app (wrap-upcase app))
(run-jetty upcase-app {:port 8080})
@@ -36,15 +36,15 @@ First, pull in Ring's dependencies using [Leiningen](
To see a live "Hello World" Ring app, run:
- $ clj src/ring/example/hello_world.clj
+ $ clj example/hello_world.clj
Now visit `http://localhost:8080/` in your browser; the Ring app will respond to your request with a simple HTML page indicating the time of day.
Note that your `clj` script needs to add the `src` directory and the jars in `lib` to your classpath.
To see a more sophisticated Ring app, run:
- $ clj src/ring/example/wrapping.clj
+ $ clj example/wrapping.clj
* If you request `http://localhost:8080/` in your browser the `ring.handler.dump` handler will respond with an HTML page representing the request map that it received (see the `SPEC` for details on the request map).
* If you request `http://localhost:8080/clojure.png`, the `ring.middleware.file` middleware will detect that there is a `clojure.png` file in the app's `public` directory and return that image as a response.
@@ -68,11 +68,11 @@ Included Libs
-Ring is being actively developed; you can track its progress and contribute at the project's [GitHub]( page.
+Ring is being actively developed; you can track its progress and contribute at the project's [GitHub page]( and [Google Group](
To run all the Ring unit tests:
- $ clj test/ring/run.clj
+ $ lein test
@@ -82,6 +82,6 @@ This project borrows heavily from Ruby's Rack and Python's WSGI, and I thank the
-Copyright (c) 2009 Mark McGranaghan and released under an MIT license.
+Copyright (c) 2009-2010 Mark McGranaghan and released under an MIT license.
Clojure logo by Tom Hickey.
@@ -4,14 +4,13 @@
(:use ring.adapter.jetty)
(:import java.util.Date java.text.SimpleDateFormat))
-(def formatter (SimpleDateFormat. "HH:mm:ss"));
(defn app
{:status 200
:headers {"Content-Type" "text/html"}
:body (str "<h3>Hello World from Ring</h3>"
"<p>The current time is "
- (.format formatter (Date.)) ".</p>")})
+ (.format (SimpleDateFormat. "HH:mm:ss") (Date.))
+ ".</p>")})
(run-jetty app {:port 8080})
@@ -13,9 +13,9 @@
- (wrap-file "src/ring/example/public")
+ (wrap-file "example/public")
- (wrap-reload '(ring.dump)
- wrap-lint)))
+ (wrap-reload '(ring.handler.dump))
+ wrap-lint))
-(run-jetty app {:port 8080})
+(run-jetty app {:port 8080})
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -15,7 +15,7 @@
(def app
(-> handle-dump
- (wrap-file "src/ring/example/public")
+ (wrap-file "example/public")
@@ -60,7 +60,7 @@
(defn- get-extension
"Returns the file extension of a file."
- [file]
+ [#^File file]
(second (re-find #"\.([^./\\]+)$" (.getPath file))))
(defn- guess-mime-type

0 comments on commit f2f4229

Please sign in to comment.