Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Doc and example tweaks.

  • Loading branch information...
commit f2f42293e86198bb2a1c6411819ded5d3d82cd35 1 parent 7271607
@mmcgrana authored
View
2  LICENSE
@@ -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
View
14 README.markdown
@@ -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,7 +36,7 @@ First, pull in Ring's dependencies using [Leiningen](http://github.com/technoman
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.
@@ -44,7 +44,7 @@ Note that your `clj` script needs to add the `src` directory and the jars in `li
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
Development
-----------
-Ring is being actively developed; you can track its progress and contribute at the project's [GitHub](http://github.com/mmcgrana/ring) page.
+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).
To run all the Ring unit tests:
- $ clj test/ring/run.clj
+ $ lein test
Thanks
------
@@ -82,6 +82,6 @@ This project borrows heavily from Ruby's Rack and Python's WSGI, and I thank the
License
-------
-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.
View
5 example/hello_world.clj
@@ -4,14 +4,13 @@
(:use ring.adapter.jetty)
(:import java.util.Date java.text.SimpleDateFormat))
-(def formatter (SimpleDateFormat. "HH:mm:ss"));
-
(defn app
[req]
{: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})
View
8 example/linted.clj
@@ -13,9 +13,9 @@
wrap-lint
wrap-file-info
wrap-lint
- (wrap-file "src/ring/example/public")
+ (wrap-file "example/public")
wrap-lint
- (wrap-reload '(ring.dump)
- wrap-lint)))
+ (wrap-reload '(ring.handler.dump))
+ wrap-lint))
-(run-jetty app {:port 8080})
+(run-jetty app {:port 8080})
View
BIN  example/public/clojure.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  example/wrapping.clj
@@ -15,7 +15,7 @@
(def app
(-> handle-dump
wrap-error
- (wrap-file "src/ring/example/public")
+ (wrap-file "example/public")
wrap-file-info
wrap-stacktrace))
View
2  src/ring/middleware/file_info.clj
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.