Skip to content
This repository
Browse code

Doc and example tweaks.

  • Loading branch information...
commit f2f42293e86198bb2a1c6411819ded5d3d82cd35 1 parent 7271607
Mark McGranaghan authored
2  LICENSE
... ... @@ -1,4 +1,4 @@
1   -Copyright (c) 2009 Mark McGranaghan
  1 +Copyright (c) 2009-2010 Mark McGranaghan
2 2
3 3 Permission is hereby granted, free of charge, to any person
4 4 obtaining a copy of this software and associated documentation
14 README.markdown
Source Rendered
@@ -18,12 +18,12 @@ A Ring handler:
18 18
19 19 Adding simple middleware:
20 20
21   - (defn with-upcase [app]
  21 + (defn wrap-upcase [app]
22 22 (fn [req]
23 23 (let [orig-resp (app req)]
24 24 (assoc orig-resp :body (.toUpperCase (:body orig-resp))))))
25 25
26   - (def upcase-app (with-upcase app))
  26 + (def upcase-app (wrap-upcase app))
27 27
28 28 (run-jetty upcase-app {:port 8080})
29 29
@@ -36,7 +36,7 @@ First, pull in Ring's dependencies using [Leiningen](http://github.com/technoman
36 36
37 37 To see a live "Hello World" Ring app, run:
38 38
39   - $ clj src/ring/example/hello_world.clj
  39 + $ clj example/hello_world.clj
40 40
41 41 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.
42 42
@@ -44,7 +44,7 @@ Note that your `clj` script needs to add the `src` directory and the jars in `li
44 44
45 45 To see a more sophisticated Ring app, run:
46 46
47   - $ clj src/ring/example/wrapping.clj
  47 + $ clj example/wrapping.clj
48 48
49 49 * 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).
50 50 * 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
68 68 Development
69 69 -----------
70 70
71   -Ring is being actively developed; you can track its progress and contribute at the project's [GitHub](http://github.com/mmcgrana/ring) page.
  71 +Ring is being actively developed; you can track its progress and contribute at the project's [GitHub page](http://github.com/mmcgrana/ring) and [Google Group](http://groups.google.com/group/ring-clojure).
72 72
73 73 To run all the Ring unit tests:
74 74
75   - $ clj test/ring/run.clj
  75 + $ lein test
76 76
77 77 Thanks
78 78 ------
@@ -82,6 +82,6 @@ This project borrows heavily from Ruby's Rack and Python's WSGI, and I thank the
82 82 License
83 83 -------
84 84
85   -Copyright (c) 2009 Mark McGranaghan and released under an MIT license.
  85 +Copyright (c) 2009-2010 Mark McGranaghan and released under an MIT license.
86 86
87 87 Clojure logo by Tom Hickey.
5 example/hello_world.clj
@@ -4,14 +4,13 @@
4 4 (:use ring.adapter.jetty)
5 5 (:import java.util.Date java.text.SimpleDateFormat))
6 6
7   -(def formatter (SimpleDateFormat. "HH:mm:ss"));
8   -
9 7 (defn app
10 8 [req]
11 9 {:status 200
12 10 :headers {"Content-Type" "text/html"}
13 11 :body (str "<h3>Hello World from Ring</h3>"
14 12 "<p>The current time is "
15   - (.format formatter (Date.)) ".</p>")})
  13 + (.format (SimpleDateFormat. "HH:mm:ss") (Date.))
  14 + ".</p>")})
16 15
17 16 (run-jetty app {:port 8080})
8 example/linted.clj
@@ -13,9 +13,9 @@
13 13 wrap-lint
14 14 wrap-file-info
15 15 wrap-lint
16   - (wrap-file "src/ring/example/public")
  16 + (wrap-file "example/public")
17 17 wrap-lint
18   - (wrap-reload '(ring.dump)
19   - wrap-lint)))
  18 + (wrap-reload '(ring.handler.dump))
  19 + wrap-lint))
20 20
21   -(run-jetty app {:port 8080})
  21 +(run-jetty app {:port 8080})
BIN  example/public/clojure.png
2  example/wrapping.clj
@@ -15,7 +15,7 @@
15 15 (def app
16 16 (-> handle-dump
17 17 wrap-error
18   - (wrap-file "src/ring/example/public")
  18 + (wrap-file "example/public")
19 19 wrap-file-info
20 20 wrap-stacktrace))
21 21
2  src/ring/middleware/file_info.clj
@@ -60,7 +60,7 @@
60 60
61 61 (defn- get-extension
62 62 "Returns the file extension of a file."
63   - [file]
  63 + [#^File file]
64 64 (second (re-find #"\.([^./\\]+)$" (.getPath file))))
65 65
66 66 (defn- guess-mime-type

0 comments on commit f2f4229

Please sign in to comment.
Something went wrong with that request. Please try again.