Permalink
...
Comparing changes
Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
ring-clojure/ring
mmcgrana/ring
AlexBaranosky/ring
Buttacavoli/ring
DavyLin/ring
DerGuteMoritz/ring
Dorian/ring
KushalP/ring
MichaelDrogalis/ring
PaulSandoz/ring
PetrGlad/ring
QinBin/ring
RafalBabinicz/ring
Tankanow/ring
aaronc/ring
aleksandersumowski/ring
alexandrkozyrev/ring
andrewvc/ring
arohner/ring
arzyc/ring
bendlas/ring
berhoden/ring
bmaddy/ring
briprowe/ring
bvandgrift/ring
bwhmather/ring
casperc/ring
ceales/ring
cgrand/ring
cheddar/ring
christophermaier/ring
cldwalker/ring
clojure-china/ring
clojurian/ring
cloudvast/ring
coopernurse/ring
daemianmack/ring
danjohansson/ring
datianshi/ring
davesann/ring
davidjagoe/ring
davidrd123/ring
davidsantiago/ring
dcmoore/ring
deTonnewman/ring
derekchiang/ring
djpowell/ring
dm3/ring
draftkraft/ring
drewr/ring
eagleflo/ring
edtsech/ring
emidln/ring
endotoh/ring
ericnormand/ring
eunmin/ring
fantasticsid/ring
fanweixiao/ring
funcio/ring
gfZeng/ring
gtrak/ring
gugl/ring
guns/ring
guruma/ring
halfprogrammer/ring
haliphron/ring
haozi89/ring
hatemogi/ring
hozumi/ring
hugoduncan/ring
hura/ring
ibodrov/ring
ikitommi/ring
instilled/ring
ithayer/ring
itoshkov/ring
itraor/ring
jaceklaskowski/ring
jackdempsey/ring
jafingerhut/ring
jalpedersen/ring
jamiepg1/ring
jasonbs10/ring
jcromartie/ring
jcrossley3/ring
jduey/ring
jkk/ring
joelittlejohn/ring
johnbendi/ring
joseph-hurtado/ring
josephwilk/ring
josephzizys/ring
jsnikeris/ring
juergenhoetzel/ring
jxa/ring
kavu/ring
kbidarkar/ring
keli/ring
keoko/ring
korotinm/ring
kurman/ring
l0st3d/ring
lahorichargha/ring
lancecarlson/ring
laoxu/ring
lbt05/ring
likestream/ring
likon/ring
liujiaqiid/ring
llasram/ring
lloydhome/ring
logosity/ring
lolownia/ring
lrq1988/ring
lynaghk/ring
macourtney/ring
magomimmo/ring
maravillas/ring
mattyw/ring
maxcountryman/ring
maxgfaraday/ring
maxweber/ring
mcav/ring
michaelklishin/ring
michaelsbradleyjr/ring
michelangelo13/ring
mikejs/ring
minleychris/ring
mirrormatch/ring
misfo/ring
mrh0057/ring
mtopolnik/ring
mvelliste/ring
mw10013/ring
my-cat/ring
mybuddymichael/ring
nahuel/ring
ndimiduk/ring
nicolas-ginder/ring
ninjudd/ring
njackson/ring
nunb/ring
nyer/ring
obohrer/ring
ordnungswidrig/ring
ossareh/ring
otfrom/ring
otrewyi191/ring
paraseba/ring
pcalcado/ring
pepijndevos/ring
petergarbers/ring
peterwang/ring
pingles/ring
piprime/ring
pjb3/ring
pmj/ring
pombredanne/ring
prodigeni/ring
proger/ring
pschorf/ring
ptaoussanis/ring
ragnard/ring
redinger/ring
rj747/ring
rjack/ring
rmfbarker/ring
rnewman/ring
rock117/ring
rosado/ring
rsuniev/ring
runexec/ring
ryantm/ring
ryfow/ring
sanshi0518/ring
scarytom/ring
sebastiansen/ring
shenfeng/ring
shjgiser/ring
shyblower/ring
sivajag/ring
slagyr/ring
stuarthalloway/ring
tbatchelli/ring
techwhizbang/ring
tendant/ring
teropa/ring
thobbs/ring
timvisher/ring
tlh/ring
trevor/ring
trptcolin/ring
tvaughan/ring
ugglan/ring
ultonis/ring
universsky/ring
wangdanny/ring
wasserfuhr/ring
wuzhenzhou/ring
zamaterian/ring
Nothing to show
Choose a base branch
Nothing to show
Choose a Head Repository
ring-clojure/ring
mmcgrana/ring
AlexBaranosky/ring
Buttacavoli/ring
DavyLin/ring
DerGuteMoritz/ring
Dorian/ring
KushalP/ring
MichaelDrogalis/ring
PaulSandoz/ring
PetrGlad/ring
QinBin/ring
RafalBabinicz/ring
Tankanow/ring
aaronc/ring
aleksandersumowski/ring
alexandrkozyrev/ring
andrewvc/ring
arohner/ring
arzyc/ring
bendlas/ring
berhoden/ring
bmaddy/ring
briprowe/ring
bvandgrift/ring
bwhmather/ring
casperc/ring
ceales/ring
cgrand/ring
cheddar/ring
christophermaier/ring
cldwalker/ring
clojure-china/ring
clojurian/ring
cloudvast/ring
coopernurse/ring
daemianmack/ring
danjohansson/ring
datianshi/ring
davesann/ring
davidjagoe/ring
davidrd123/ring
davidsantiago/ring
dcmoore/ring
deTonnewman/ring
derekchiang/ring
djpowell/ring
dm3/ring
draftkraft/ring
drewr/ring
eagleflo/ring
edtsech/ring
emidln/ring
endotoh/ring
ericnormand/ring
eunmin/ring
fantasticsid/ring
fanweixiao/ring
funcio/ring
gfZeng/ring
gtrak/ring
gugl/ring
guns/ring
guruma/ring
halfprogrammer/ring
haliphron/ring
haozi89/ring
hatemogi/ring
hozumi/ring
hugoduncan/ring
hura/ring
ibodrov/ring
ikitommi/ring
instilled/ring
ithayer/ring
itoshkov/ring
itraor/ring
jaceklaskowski/ring
jackdempsey/ring
jafingerhut/ring
jalpedersen/ring
jamiepg1/ring
jasonbs10/ring
jcromartie/ring
jcrossley3/ring
jduey/ring
jkk/ring
joelittlejohn/ring
johnbendi/ring
joseph-hurtado/ring
josephwilk/ring
josephzizys/ring
jsnikeris/ring
juergenhoetzel/ring
jxa/ring
kavu/ring
kbidarkar/ring
keli/ring
keoko/ring
korotinm/ring
kurman/ring
l0st3d/ring
lahorichargha/ring
lancecarlson/ring
laoxu/ring
lbt05/ring
likestream/ring
likon/ring
liujiaqiid/ring
llasram/ring
lloydhome/ring
logosity/ring
lolownia/ring
lrq1988/ring
lynaghk/ring
macourtney/ring
magomimmo/ring
maravillas/ring
mattyw/ring
maxcountryman/ring
maxgfaraday/ring
maxweber/ring
mcav/ring
michaelklishin/ring
michaelsbradleyjr/ring
michelangelo13/ring
mikejs/ring
minleychris/ring
mirrormatch/ring
misfo/ring
mrh0057/ring
mtopolnik/ring
mvelliste/ring
mw10013/ring
my-cat/ring
mybuddymichael/ring
nahuel/ring
ndimiduk/ring
nicolas-ginder/ring
ninjudd/ring
njackson/ring
nunb/ring
nyer/ring
obohrer/ring
ordnungswidrig/ring
ossareh/ring
otfrom/ring
otrewyi191/ring
paraseba/ring
pcalcado/ring
pepijndevos/ring
petergarbers/ring
peterwang/ring
pingles/ring
piprime/ring
pjb3/ring
pmj/ring
pombredanne/ring
prodigeni/ring
proger/ring
pschorf/ring
ptaoussanis/ring
ragnard/ring
redinger/ring
rj747/ring
rjack/ring
rmfbarker/ring
rnewman/ring
rock117/ring
rosado/ring
rsuniev/ring
runexec/ring
ryantm/ring
ryfow/ring
sanshi0518/ring
scarytom/ring
sebastiansen/ring
shenfeng/ring
shjgiser/ring
shyblower/ring
sivajag/ring
slagyr/ring
stuarthalloway/ring
tbatchelli/ring
techwhizbang/ring
tendant/ring
teropa/ring
thobbs/ring
timvisher/ring
tlh/ring
trevor/ring
trptcolin/ring
tvaughan/ring
ugglan/ring
ultonis/ring
universsky/ring
wangdanny/ring
wasserfuhr/ring
wuzhenzhou/ring
zamaterian/ring
Nothing to show
Choose a head branch
Nothing to show
6
contributors
Commits on Dec 28, 2011
|
|
weavejester |
More response building utility functions
|
f132606
|
Commits on Dec 30, 2011
|
|
ghoseb |
Add a few type hints to avoid reflection.
|
a4fd130
|
Commits on Dec 31, 2011
|
|
weavejester |
Merge pull request #47 from ghoseb/master
Add a few type hints to avoid reflection |
b6e89d3
|
Commits on Jan 01, 2012
|
|
weavejester |
Added :max-threads option to Jetty adapter (fixes #48)
|
9adf1e6
|
Commits on Jan 15, 2012
|
|
Giacomo Ritucci |
move parse-params to ring.util.codec, renamed as form-decode
|
58e5860
|
|||
|
|
Giacomo Ritucci |
form-encode implemented
|
638c1e3
|
|||
|
|
Giacomo Ritucci |
form-decode: encoding defaults to "UTF-8"
|
e2d030d
|
|||
|
|
Giacomo Ritucci |
test for form-encode and form-decode
|
4bd7933
|
Commits on Feb 11, 2012
|
|
weavejester |
Merge branch '1.0'
|
41545ea
|
Commits on Feb 12, 2012
|
|
weavejester |
Added the response? function
|
63ccb94
|
Commits on Feb 19, 2012
|
|
weavejester |
Added .lein-deps-sum to .gitignore
|
8cef05a
|
|||
|
|
weavejester |
Updated Codox dependency to 0.4.1
|
35db0a3
|
Commits on Feb 23, 2012
Commits on Feb 25, 2012
Commits on Mar 01, 2012
|
|
weavejester |
Revert "Added :trust-all? option to run-jetty"
The Jetty 7 API docs are not always accurate about what a function does. The setTrustAll method only applies when there is no keystore or truststore, rendering it useless for client certificates. This reverts commit 00bb43e. |
be3475f
|
|||
|
|
weavejester |
Fixed setTrustStore method name
|
36f7507
|
|||
|
|
weavejester |
Support for KeyStore instances in Jetty adapter
|
8978cbf
|
Commits on Mar 03, 2012
|
|
weavejester |
Updated Apache Commons dependencies
|
cfe0af3
|
|||
|
|
weavejester |
Upgraded Hiccup dependency to 1.0.0-beta1
|
b25e0e9
|
|||
|
|
weavejester |
Slimmed down README
A lot of the information in the README can be put in the wiki instead. Now the README contains a brief overview, installation instructions, and a link to the API docs and wiki. |
e965929
|
|||
|
|
weavejester |
Removed example directory
A better place for examples would be linked from the wiki. |
c8089a8
|
|||
|
|
weavejester |
Updated Codox dependency to 0.5.0
|
2ad5b67
|
Commits on Mar 04, 2012
|
|
weavejester |
Added Google group link to README
|
4c849e6
|
|||
|
|
weavejester |
Reduced default max number of Jetty threads to 50
Cloud environments like Heroku tend to have limit how many native threads you can have per process. Setting a lower default value means people won't be caught out as easily. |
3bdf0d3
|
Commits on Mar 17, 2012
|
|
KushalP |
Simplify the equlity check against 0
Replace this with (zero? ...) |
888a529
|
|||
|
|
weavejester |
Merge pull request #61 from KushalP/master
Simplify the equality check against 0 |
cf038f7
|
|||
|
|
weavejester |
Cookie parsing handles invalid URL-encoded cookies (fixes #51)
|
e2eb01f
|
Commits on Mar 19, 2012
|
|
weavejester |
Added piped-input-stream function and test (see #57)
|
965c1d6
|
|||
|
|
weavejester |
Moved string-input-stream to ring.util.io (see #57)
|
1e290d3
|
|||
|
|
weavejester |
Updated project.clj files to Leiningen 2
|
80ddf5c
|
|||
|
|
KushalP |
Add clj-time Intervals/DateTime for :max-age and :expires (fixes #55)
- Add a test for :max-age and :expires to (wrap-cookies ...). There were no real tests to exercise the base input cases (int, string) which the comment block states. This test just makes sure it fulfils that contract. - clj-time is now a project dependency - :max-age accepts an Interval as input. Updated (write-attr-map ...) to accept an Interval (from JodaTime) as well as an int. The interface from clj-time is used. - :expires accepts a DateTime object. It converts the DateTime object in the equivalent RFC822 which the cookie spec requires. - Added pre-conditions for :max-age and :expires to make sure that they only accept Interval and DateTime, respectively. |
75c90aa
|
Commits on Mar 21, 2012
|
|
weavejester |
Merge pull request #62 from KushalP/master
Support clj-time Intervals/DateTime for :max-age and :expires |
86a0442
|
|||
|
|
weavejester |
Replaced references to ring.util.test with ring.util.io (fixes #57)
|
18db74b
|
Commits on Mar 22, 2012
|
|
weavejester |
Added wrap-head middleware (fixes #60)
|
d094e7d
|
|||
|
|
weavejester |
Merge pull request #49 from rjack/parse-params-exposed
Refactor parameter parsing |
84446f6
|
Commits on Mar 23, 2012
|
|
weavejester |
Moved assoc-param to ring.util.data/assoc+
|
c1e23d5
|
|||
|
|
weavejester |
Technically correct version of URL/percent-encoding
Java's URLEncoder and URLDecoder classes don't follow the URL-encoding format precisely, instead encoding strings in the slightly different www-form-urlencoded format. This commit ensures that the url-encode and url-decode functions work correctly, leaving it up to the form-encode and form-decode functions to handle data encoded in the www-form-urlencoded format. |
98bb0b9
|
Commits on Mar 24, 2012
|
|
weavejester |
Protocol for form-encode to support strings and maps
|
053832d
|
|||
|
|
weavejester |
form-decode decodes into strings or maps
|
a7a883c
|
|||
|
|
weavejester |
Fixed wrap-cookies with form-decode-str function
Cookies still need to be www-form-urlencoded using the URLEncoder and URLDecoder classes to maintain backward compatibility. |
5b81dce
|
|||
|
|
weavejester |
Renamed assoc+ to assoc-conj
|
7f42a8e
|
|||
|
|
weavejester |
Release 1.1.0-beta1
|
95fac93
|
|||
|
|
Bill Caputo |
run-jetty configurator applied last. Includes tests.
|
e7d7931
|
|||
|
|
weavejester |
Merge pull request #65 from logosity/master
run-jetty :configurator set to run last |
f73c6a8
|
Commits on Mar 26, 2012
|
|
weavejester |
Updated Codox to 0.6.0
|
96b24cf
|
|||
|
|
weavejester |
Released 1.1.0-beta2
|
3d98132
|
Commits on Apr 06, 2012
Commits on Apr 10, 2012
|
|
lynaghk |
Add :allow-symlink? option to wrap-file middleware (defaults to false).
|
efeb62c
|
|||
|
|
weavejester |
Merge pull request #68 from lynaghk/master
Option for wrap-file middleware to serve symlinks |
6eacec1
|
Commits on Apr 11, 2012
Commits on Apr 21, 2012
|
|
weavejester |
Updated Hiccup to 1.0.0-RC3
|
b151179
|
Commits on Apr 23, 2012
|
|
weavejester |
Updated Hiccup to 1.0.0
|
26521a9
|
|||
|
|
weavejester |
Released 1.1.0
|
269d28e
|
Commits on May 25, 2012
|
|
weavejester |
Deprecated repository in README
|
6b8d491
|
Showing
with
654 additions
and 400 deletions.
- +2 −0 .gitignore
- +17 −0 HISTORY.md
- +4 −118 README.md
- +5 −1 SPEC
- +0 −16 example/hello_world.clj
- +0 −21 example/linted.clj
- BIN example/public/clojure.png
- +0 −23 example/wrapping.clj
- +8 −8 project.clj
- +7 −5 ring-core/project.clj
- +21 −11 ring-core/src/ring/middleware/cookies.clj
- +1 −1 ring-core/src/ring/middleware/file.clj
- +14 −0 ring-core/src/ring/middleware/head.clj
- +2 −2 ring-core/src/ring/middleware/multipart_params.clj
- +4 −25 ring-core/src/ring/middleware/params.clj
- +4 −7 ring-core/src/ring/middleware/session/cookie.clj
- +92 −8 ring-core/src/ring/util/codec.clj
- +13 −0 ring-core/src/ring/util/data.clj
- +31 −0 ring-core/src/ring/util/io.clj
- +43 −3 ring-core/src/ring/util/response.clj
- +5 −7 ring-core/src/ring/util/test.clj
- +1 −0 ring-core/test/ring/assets/bars/backlink
- +1 −1 ring-core/test/ring/middleware/multipart_params/test/byte_array.clj
- +1 −1 ring-core/test/ring/middleware/multipart_params/test/temp_file.clj
- +61 −1 ring-core/test/ring/middleware/test/cookies.clj
- +16 −0 ring-core/test/ring/middleware/test/head.clj
- +1 −1 ring-core/test/ring/middleware/test/multipart_params.clj
- +6 −6 ring-core/test/ring/middleware/test/params.clj
- +1 −1 ring-core/test/ring/middleware/test/resource.clj
- +48 −7 ring-core/test/ring/util/test/codec.clj
- +12 −0 ring-core/test/ring/util/test/io.clj
- +53 −0 ring-core/test/ring/util/test/response.clj
- +3 −3 ring-devel/project.clj
- +36 −0 ring-devel/resources/ring/css/dump.css
- 0 ring-devel/resources/{ → ring}/css/stacktrace.css
- +21 −55 ring-devel/src/ring/handler/dump.clj
- +2 −5 ring-devel/src/ring/middleware/stacktrace.clj
- +3 −3 ring-devel/test/ring/handler/test/dump.clj
- +3 −3 ring-devel/test/ring/middleware/test/lint.clj
- +6 −6 ring-jetty-adapter/project.clj
- +40 −24 ring-jetty-adapter/src/ring/adapter/jetty.clj
- BIN ring-jetty-adapter/test/keystore.jks
- +34 −7 ring-jetty-adapter/test/ring/adapter/test/jetty.clj
- +2 −2 ring-servlet/project.clj
- +8 −2 ring-servlet/src/ring/util/servlet.clj
- +22 −16 ring-servlet/test/ring/util/test/servlet.clj
2
.gitignore
17
HISTORY.md
122
README.md
| @@ -1,119 +1,5 @@ | ||
| -# Ring | ||
| +## Ring has moved to: <https://github.com/ring-clojure/ring> | ||
| -Ring is a Clojure web applications library inspired by Python's WSGI and Ruby's Rack. By abstracting the details of HTTP into a simple, unified API, Ring allows web applications to be constructed of modular components that can be shared among a variety of applications, web servers, and web frameworks. | ||
| - | ||
| -The `SPEC` file at the root of this distribution for provides a complete description of the Ring interface. | ||
| - | ||
| -## Synopsis | ||
| - | ||
| -"Hello World" in Ring: | ||
| - | ||
| - (use 'ring.adapter.jetty) | ||
| - | ||
| - (defn app [req] | ||
| - {:status 200 | ||
| - :headers {"Content-Type" "text/html"} | ||
| - :body "Hello World from Ring"}) | ||
| - | ||
| - (run-jetty app {:port 8080}) | ||
| - | ||
| -Adding simple middleware: | ||
| - | ||
| - (defn wrap-upcase [app] | ||
| - (fn [req] | ||
| - (let [orig-resp (app req)] | ||
| - (assoc orig-resp :body (.toUpperCase (:body orig-resp)))))) | ||
| - | ||
| - (def upcase-app (wrap-upcase app)) | ||
| - | ||
| - (run-jetty upcase-app {:port 8080}) | ||
| - | ||
| -## Quick Start | ||
| - | ||
| -To see some working examples, first pull in Ring's dependencies using [Leiningen](http://github.com/technomancy/leiningen): | ||
| - | ||
| - $ lein deps | ||
| - | ||
| -To see a live "Hello World" Ring app, run: | ||
| - | ||
| - $ java -cp "lib/*" clojure.main 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. | ||
| - | ||
| -To see a more sophisticated Ring app, run: | ||
| - | ||
| - $ java -cp "lib/*" clojure.main 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. | ||
| -* If you request `http://localhost:8080/error`, the app will produce an error that will be caught by the `ring.middleware.stacktrace` middleware, which will in turn return a readable stacktrace as the HTML response. | ||
| - | ||
| - | ||
| -## Documentation | ||
| - | ||
| -* [Ring namespace and function docs](http://mmcgrana.github.com/ring/) | ||
| - | ||
| -## Available Libraries | ||
| - | ||
| -### ring-core | ||
| - | ||
| -* `ring.middleware.file`: Serve static files out of a public directory. | ||
| -* `ring.middleware.resource`: Serve static classpath resources. | ||
| -* `ring.middleware.file-info`: Augment response headers with info about File responses. | ||
| -* `ring.middleware.content-type`: Augment response headers with a content-type based on the file extension. | ||
| -* `ring.middleware.params`: Parse query and form params. | ||
| -* `ring.middleware.multipart-params`: Parse multipart params. | ||
| -* `ring.middleware.keyword-params`: Convert string param keys to keywords. | ||
| -* `ring.middleware.nested-params`: Convert a flat map of parameters into a nested map of parameters. | ||
| -* `ring.middleware.cookies`: Manage browser cookies. | ||
| -* `ring.middleware.session`: Manage user sessions. Memory and cookie session stores are available by default. | ||
| -* `ring.middleware.flash`: Adds flash message support to sessions. | ||
| -* `ring.util.response`: Generate Ring responses. | ||
| -* `ring.util.codec`: Encode and decode string data. | ||
| -* `ring.util.mime-type`: Guess the mime-type from a file extension. | ||
| - | ||
| -### ring-devel | ||
| - | ||
| -* `ring.handler.dump`: Dumps request maps as HTML responses for debugging. | ||
| -* `ring.middleware.lint`: Lint requests and responses to ensure compliance with the Ring spec. | ||
| -* `ring.middleware.reload`: Automatically reload modified namespaces before each request. | ||
| -* `ring.middleware.stacktrace`: Catch exceptions and displays readable stacktraces for debugging. | ||
| - | ||
| -### ring-servlet | ||
| - | ||
| -* `ring.util.servlet`: Utilities for interfacing with Java Servlets. | ||
| - | ||
| -### ring-jetty-adapter | ||
| - | ||
| -* `ring.adapter.jetty`: Adapter for the Jetty webserver. | ||
| - | ||
| -## Leiningen Usage | ||
| - | ||
| -To include one of the above libraries in your Leiningen project, for example `ring-core`, add the following to your `:dependencies`: | ||
| - | ||
| - [ring/ring-core "1.0.2"] | ||
| - | ||
| -To include all of them, add: | ||
| - | ||
| - [ring "1.0.2"] | ||
| - | ||
| -## Development | ||
| - | ||
| -Ring is being actively developed; you can track its progress on the [GitHub page](http://github.com/mmcgrana/ring) page and on the [Google Group](http://groups.google.com/group/ring-clojure). | ||
| - | ||
| -To submit a patch, please post your corresponding GitHub branch to the Ring Google Group. This allows your changes to be seen and discussed by all Ring developers. If you are attempting something substantial, consider posting to the Google Group first with your idea. | ||
| - | ||
| -To run the Ring unit tests, first navigate to the appropriate project and then: | ||
| - | ||
| - $ lein deps | ||
| - $ lein test | ||
| - | ||
| -## Thanks | ||
| - | ||
| -This project borrows heavily from Ruby's Rack and Python's WSGI; thanks to those communities for their work. | ||
| - | ||
| -## License | ||
| - | ||
| -Copyright (c) 2009-2011 Mark McGranaghan and released under an MIT license. | ||
| - | ||
| -Clojure logo by Tom Hickey. | ||
| +Ring has been moved to dedicated GitHub organization. This repository | ||
| +will no longer be updated, so please update your bookmarks and | ||
| +GitHub watches. |
6
SPEC
16
example/hello_world.clj
| @@ -1,16 +0,0 @@ | ||
| -; A very simple Ring application. | ||
| - | ||
| -(ns ring.example.hello-world | ||
| - (:use ring.adapter.jetty) | ||
| - (:import java.util.Date java.text.SimpleDateFormat)) | ||
| - | ||
| -(defn app | ||
| - [req] | ||
| - {:status 200 | ||
| - :headers {"Content-Type" "text/html"} | ||
| - :body (str "<h3>Hello World from Ring</h3>" | ||
| - "<p>The current time is " | ||
| - (.format (SimpleDateFormat. "HH:mm:ss") (Date.)) | ||
| - ".</p>")}) | ||
| - | ||
| -(run-jetty app {:port 8080}) |
21
example/linted.clj
| @@ -1,21 +0,0 @@ | ||
| -; An example of inserting the linter between each component to ensure | ||
| -; compliance to the Ring spec. | ||
| - | ||
| -(ns ring.example.linted | ||
| - (:use (ring.handler dump) | ||
| - (ring.middleware stacktrace file file-info reload lint) | ||
| - (ring.adapter jetty))) | ||
| - | ||
| -(def app | ||
| - (-> handle-dump | ||
| - wrap-lint | ||
| - wrap-stacktrace | ||
| - wrap-lint | ||
| - wrap-file-info | ||
| - wrap-lint | ||
| - (wrap-file "example/public") | ||
| - wrap-lint | ||
| - (wrap-reload '(ring.handler.dump)) | ||
| - wrap-lint)) | ||
| - | ||
| -(run-jetty app {:port 8080}) |
BIN
example/public/clojure.png
Deleted file not rendered
23
example/wrapping.clj
| @@ -1,23 +0,0 @@ | ||
| -; A example of modular construction of Ring apps. | ||
| - | ||
| -(ns ring.example.wrapping | ||
| - (:use ring.handler.dump | ||
| - ring.middleware.stacktrace | ||
| - ring.middleware.file-info | ||
| - ring.middleware.file | ||
| - ring.adapter.jetty)) | ||
| - | ||
| -(defn wrap-error [app] | ||
| - (fn [req] | ||
| - (if (= "/error" (:uri req)) | ||
| - (throw (Exception. "Demonstrating ring.middleware.stacktrace")) | ||
| - (app req)))) | ||
| - | ||
| -(def app | ||
| - (-> handle-dump | ||
| - wrap-error | ||
| - (wrap-file "example/public") | ||
| - wrap-file-info | ||
| - wrap-stacktrace)) | ||
| - | ||
| -(run-jetty app {:port 8080}) |
16
project.clj
12
ring-core/project.clj
| @@ -1,9 +1,11 @@ | ||
| -(defproject ring/ring-core "1.0.2" | ||
| +(defproject ring/ring-core "1.1.0" | ||
| :description "Ring core libraries." | ||
| :url "http://github.com/mmcgrana/ring" | ||
| :dependencies [[org.clojure/clojure "1.2.1"] | ||
| - [commons-codec "1.4"] | ||
| - [commons-io "1.4"] | ||
| + [commons-codec "1.6"] | ||
| + [commons-io "2.1"] | ||
| [commons-fileupload "1.2.1"] | ||
| - [javax.servlet/servlet-api "2.5"]] | ||
| - :dev-dependencies [[org.clojure/clojure-contrib "1.2.0"]]) | ||
| + [javax.servlet/servlet-api "2.5"] | ||
| + [clj-time "0.3.7"]] | ||
| + :profiles | ||
| + {:dev {:dependencies [[org.clojure/clojure-contrib "1.2.0"]]}}) |
32
ring-core/src/ring/middleware/cookies.clj
2
ring-core/src/ring/middleware/file.clj
14
ring-core/src/ring/middleware/head.clj
| @@ -0,0 +1,14 @@ | ||
| +(ns ring.middleware.head | ||
| + "Middleware to simplify replying to HEAD requests.") | ||
| + | ||
| +(defn wrap-head | ||
| + "Middleware that turns any HEAD request into a GET, and then sets the response | ||
| + body to nil." | ||
| + [handler] | ||
| + (fn [request] | ||
| + (if (= :head (:request-method request)) | ||
| + (-> request | ||
| + (assoc :request-method :get) | ||
| + (handler) | ||
| + (assoc :body nil)) | ||
| + (handler request)))) |
4
ring-core/src/ring/middleware/multipart_params.clj
29
ring-core/src/ring/middleware/params.clj
11
ring-core/src/ring/middleware/session/cookie.clj
100
ring-core/src/ring/util/codec.clj
13
ring-core/src/ring/util/data.clj
| @@ -0,0 +1,13 @@ | ||
| +(ns ring.util.data | ||
| + "Miscellaneous functions for manipulating data structures.") | ||
| + | ||
| +(defn assoc-conj | ||
| + "Associate a key with a value in a map. If the key already exists in the map, | ||
| + a vector of values is associated with the key." | ||
| + [map key val] | ||
| + (assoc map key | ||
| + (if-let [cur (get map key)] | ||
| + (if (vector? cur) | ||
| + (conj cur val) | ||
| + [cur val]) | ||
| + val))) |
31
ring-core/src/ring/util/io.clj
| @@ -0,0 +1,31 @@ | ||
| +(ns ring.util.io | ||
| + "Utility functions for I/O in Ring." | ||
| + (:require [clojure.java.io :as io]) | ||
| + (:import [java.io PipedInputStream | ||
| + PipedOutputStream | ||
| + ByteArrayInputStream])) | ||
| + | ||
| +(defn piped-input-stream | ||
| + "Create an input stream from a function that takes an output stream as its | ||
| + argument. The function will be executed in a separate thread. The stream | ||
| + will be automatically closed after the function finishes. | ||
| + | ||
| + e.g. (piped-input-stream | ||
| + (fn [ostream] | ||
| + (spit ostream \"Hello\")))" | ||
| + [func] | ||
| + (let [input (PipedInputStream.) | ||
| + output (PipedOutputStream.)] | ||
| + (.connect input output) | ||
| + (future | ||
| + (try | ||
| + (func output) | ||
| + (finally (.close output)))) | ||
| + input)) | ||
| + | ||
| +(defn string-input-stream | ||
| + "Returns a ByteArrayInputStream for the given String." | ||
| + ([^String s] | ||
| + (ByteArrayInputStream. (.getBytes s))) | ||
| + ([^String s encoding] | ||
| + (ByteArrayInputStream. (.getBytes s encoding)))) |
46
ring-core/src/ring/util/response.clj
12
ring-core/src/ring/util/test.clj
| @@ -1,10 +1,8 @@ | ||
| (ns ring.util.test | ||
| "Utilities for testing Ring components." | ||
| - (:import java.io.ByteArrayInputStream)) | ||
| + (:require [ring.util.io :as io])) | ||
| -(defn string-input-stream | ||
| - "Returns a ByteArrayInputStream for the given String." | ||
| - ([^String s] | ||
| - (ByteArrayInputStream. (.getBytes s))) | ||
| - ([^String s encoding] | ||
| - (ByteArrayInputStream. (.getBytes s encoding)))) | ||
| +(def ^{:doc "Returns a ByteArrayInputStream for the given String." | ||
| + :deprecated "1.1"} | ||
| + string-input-stream | ||
| + io/string-input-stream) |
1
ring-core/test/ring/assets/bars/backlink
| @@ -0,0 +1 @@ | ||
| +../ |
2
ring-core/test/ring/middleware/multipart_params/test/byte_array.clj
2
ring-core/test/ring/middleware/multipart_params/test/temp_file.clj
62
ring-core/test/ring/middleware/test/cookies.clj
16
ring-core/test/ring/middleware/test/head.clj
| @@ -0,0 +1,16 @@ | ||
| +(ns ring.middleware.test.head | ||
| + (:use clojure.test | ||
| + ring.middleware.head)) | ||
| + | ||
| +(defn- handler [req] | ||
| + {:status 200 | ||
| + :headers {"X-method" (name (:request-method req))} | ||
| + :body "Foobar"}) | ||
| + | ||
| +(deftest test-wrap-head | ||
| + (let [resp ((wrap-head handler) {:request-method :head})] | ||
| + (is (nil? (:body resp))) | ||
| + (is (= "get" (get-in resp [:headers "X-method"])))) | ||
| + (let [resp ((wrap-head handler) {:request-method :post})] | ||
| + (is (= (:body resp) "Foobar")) | ||
| + (is (= "post" (get-in resp [:headers "X-method"]))))) |
2
ring-core/test/ring/middleware/test/multipart_params.clj
12
ring-core/test/ring/middleware/test/params.clj
2
ring-core/test/ring/middleware/test/resource.clj
55
ring-core/test/ring/util/test/codec.clj
12
ring-core/test/ring/util/test/io.clj
| @@ -0,0 +1,12 @@ | ||
| +(ns ring.util.test.io | ||
| + (:use clojure.test | ||
| + ring.util.io) | ||
| + (:require [clojure.java.io :as io])) | ||
| + | ||
| +(deftest test-piped-input-stream | ||
| + (let [stream (piped-input-stream #(spit % "Hello World"))] | ||
| + (is (= (slurp stream) "Hello World")))) | ||
| + | ||
| +(deftest test-string-input-stream | ||
| + (let [stream (string-input-stream "Hello World")] | ||
| + (is (= (slurp stream) "Hello World")))) |
53
ring-core/test/ring/util/test/response.clj
6
ring-devel/project.clj
| @@ -1,7 +1,7 @@ | ||
| -(defproject ring/ring-devel "1.0.2" | ||
| +(defproject ring/ring-devel "1.1.0" | ||
| :description "Ring development and debugging libraries." | ||
| :url "http://github.com/mmcgrana/ring" | ||
| - :dependencies [[ring/ring-core "1.0.2"] | ||
| - [hiccup "0.3.7"] | ||
| + :dependencies [[ring/ring-core "1.1.0"] | ||
| + [hiccup "1.0.0"] | ||
| [clj-stacktrace "0.2.4"] | ||
| [ns-tracker "0.1.1"]]) |
36
ring-devel/resources/ring/css/dump.css
| @@ -0,0 +1,36 @@ | ||
| +/* | ||
| +Copyright (c) 2008, Yahoo! Inc. All rights reserved. | ||
| +Code licensed under the BSD License: | ||
| +http://developer.yahoo.net/yui/license.txt | ||
| +version: 2.6.0 | ||
| +*/ | ||
| +html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}del,ins{text-decoration:none;} | ||
| + | ||
| +h3.info { | ||
| + font-size: 1.6em; | ||
| + margin-left: 1em; | ||
| + padding-top: .5em; | ||
| + padding-bottom: .5em; | ||
| +} | ||
| + | ||
| +table.request { | ||
| + font-size: 1.1em; | ||
| + width: 800px; | ||
| + margin-left: 1em; | ||
| + margin-right: 1em; | ||
| + background: lightgrey; | ||
| +} | ||
| + | ||
| +table.request tr { | ||
| + line-height: 1.4em; | ||
| +} | ||
| + | ||
| +table.request td.key { | ||
| + padding-left: .5em; | ||
| + text-aligh: left; | ||
| + width: 150px; | ||
| +} | ||
| + | ||
| +table.request td.val { | ||
| + text-align: left; | ||
| +} |
0
ring-devel/resources/css/stacktrace.css → ring-devel/resources/ring/css/stacktrace.css
File renamed without changes.
76
ring-devel/src/ring/handler/dump.clj
7
ring-devel/src/ring/middleware/stacktrace.clj
6
ring-devel/test/ring/handler/test/dump.clj
6
ring-devel/test/ring/middleware/test/lint.clj
12
ring-jetty-adapter/project.clj
| @@ -1,8 +1,8 @@ | ||
| -(defproject ring/ring-jetty-adapter "1.0.2" | ||
| +(defproject ring/ring-jetty-adapter "1.1.0" | ||
| :description "Ring Jetty adapter." | ||
| :url "http://github.com/mmcgrana/ring" | ||
| - :dependencies [[ring/ring-core "1.0.2"] | ||
| - [ring/ring-servlet "1.0.2"] | ||
| - [org.mortbay.jetty/jetty "6.1.25"] | ||
| - [org.mortbay.jetty/jetty-util "6.1.25"]] | ||
| - :dev-dependencies [[clj-http "0.1.3"]]) | ||
| + :dependencies [[ring/ring-core "1.1.0"] | ||
| + [ring/ring-servlet "1.1.0"] | ||
| + [org.eclipse.jetty/jetty-server "7.6.1.v20120215"]] | ||
| + :profiles | ||
| + {:dev {:dependencies [[clj-http "0.3.2"]]}}) |
64
ring-jetty-adapter/src/ring/adapter/jetty.clj
BIN
ring-jetty-adapter/test/keystore.jks
Binary file not shown.
41
ring-jetty-adapter/test/ring/adapter/test/jetty.clj
| @@ -1,20 +1,47 @@ | ||
| (ns ring.adapter.test.jetty | ||
| (:use clojure.test | ||
| ring.adapter.jetty) | ||
| - (:require [clj-http.client :as http])) | ||
| + (:require [clj-http.client :as http]) | ||
| + (:import (org.eclipse.jetty.util.thread QueuedThreadPool) | ||
| + (org.eclipse.jetty.server Server Request) | ||
| + (org.eclipse.jetty.server.handler AbstractHandler))) | ||
| (defn- hello-world [request] | ||
| {:status 200 | ||
| :headers {"Content-Type" "text/plain"} | ||
| :body "Hello World"}) | ||
| -(deftest jetty-test | ||
| - (let [server (run-jetty hello-world {:port 4347, :join? false})] | ||
| - (try | ||
| - (Thread/sleep 2000) | ||
| +(defmacro with-server [options & body] | ||
| + `(let [server# (run-jetty hello-world ~(assoc options :join? false))] | ||
| + (try | ||
| + ~@body | ||
| + (finally (.stop server#))))) | ||
| + | ||
| +(deftest test-run-jetty | ||
| + (testing "HTTP server" | ||
| + (with-server {:port 4347} | ||
| (let [response (http/get "http://localhost:4347")] | ||
| (is (= (:status response) 200)) | ||
| (is (.startsWith (get-in response [:headers "content-type"]) | ||
| "text/plain")) | ||
| - (is (= (:body response) "Hello World"))) | ||
| - (finally (.stop server))))) | ||
| + (is (= (:body response) "Hello World"))))) | ||
| + | ||
| + (testing "HTTPS server" | ||
| + (with-server {:port 4347 | ||
| + :ssl-port 4348 | ||
| + :keystore "test/keystore.jks" | ||
| + :key-password "password"} | ||
| + (let [response (http/get "https://localhost:4348" {:insecure? true})] | ||
| + (is (= (:status response) 200)) | ||
| + (is (= (:body response) "Hello World"))))) | ||
| + | ||
| + (testing "configurator set to run last" | ||
| + (let [max-threads 20 | ||
| + new-handler (proxy [AbstractHandler] [] (handle [_ ^Request base-request request response])) | ||
| + threadPool (QueuedThreadPool. ({} :max-threads max-threads)) | ||
| + configurator (fn [server] (.setThreadPool server threadPool) (.setHandler server new-handler)) | ||
| + server (run-jetty hello-world {:join? false :port 4347 :configurator configurator})] | ||
| + (is (= (.getMaxThreads (.getThreadPool server)) max-threads)) | ||
| + (is (identical? new-handler (.getHandler server))) | ||
| + (is (= 1 (count (.getHandlers server)))) | ||
| + (.stop server)))) |
4
ring-servlet/project.clj
| @@ -1,5 +1,5 @@ | ||
| -(defproject ring/ring-servlet "1.0.2" | ||
| +(defproject ring/ring-servlet "1.1.0" | ||
| :description "Ring servlet utilities." | ||
| :url "http://github.com/mmcgrana/ring" | ||
| - :dependencies [[ring/ring-core "1.0.2"] | ||
| + :dependencies [[ring/ring-core "1.1.0"] | ||
| [javax.servlet/servlet-api "2.5"]]) |
10
ring-servlet/src/ring/util/servlet.clj
38
ring-servlet/test/ring/util/test/servlet.clj
Showing you all comments on commits in this comparison.
It looks like we both had the same idea, though I've been meaning to update the Ring master branch to use the new Hiccup for a while :)
Indeed! I was trying to use the latest hiccup with my project and getting errors about page-helpers not being found. Took a while before I realised ring (via compojure) was also using hiccup. Then had a fun time trying to build and install a local dependency when I realised my OSX maven installation had crapped up, haha. But like I said, learnt a lot!
haha - i've just spent the last hour trying to stop my eyes popping out over this!
rodnaph/ring@17eaacf
i learnt a lot though
:D