| CARVIEW |
Every repository with this icon (
Every repository with this icon (
| Description: | Clojure web application library: abstracts HTTP to allow modular and concise webapps. |
| Clone URL: |
git://github.com/mmcgrana/ring.git
Give this clone URL to anyone.
git clone git://github.com/mmcgrana/ring.git
|
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon Jan 12 09:42:31 -0800 2009 | Initial import from https://github.com/mmcgrana/... [mmcgrana] |
| |
LICENSE | Mon Jan 12 09:42:31 -0800 2009 | Initial import from https://github.com/mmcgrana/... [mmcgrana] |
| |
README.textile | Tue May 05 13:33:15 -0700 2009 | rework SPEC and README to reflect new terminology [mmcgrana] |
| |
SPEC | Tue May 05 15:15:33 -0700 2009 | missing line break [mmcgrana] |
| |
build.xml | Wed Apr 29 06:46:56 -0700 2009 | Remove dependency jars from version control: ad... [mmcgrana] |
| |
src/ | Wed Apr 29 06:02:48 -0700 2009 | Merge branch 'cgrand/master' [mmcgrana] |
| |
test/ | Fri Apr 10 16:41:23 -0700 2009 | Remove legacy support for built-in currying in ... [mmcgrana] |
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.
Quick Setup
First clone the Ring source:
git clone git://github.com/mmcgrana/ring.git
cd ring
Then download the needed dependencies:
ant deps
The deps ant target downloads all Ring dependencies and unpacks them to deps/. To see a live “Hello World” Ring app, run:
then visit https://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 -Djava.ext.dirs=deps clojure.main src/ring/examples/wrapping.clj
- If you request
https://localhost:8080/in your browser thering.dumphandler will respond with an HTML page representing the request map that it received (see theSPECfor details on the request map). - If you request
https://localhost:8080/clojure.png, thering.filemiddleware will detect that there is aclojure.pngfile in the app’spublicdirectory and return that image as a response. - If you request
https://localhost:8080/error, the app will produce an error that will be caught by thering.show-exceptionsmiddleware, which will in turn return a readable backtrace as the HTML response.
h2. All Available Libs
ring.jetty: Adapter for the Jetty webserver.ring.httpcore: Adapter for the Apache HttpCore webserver.ring.file: Middleware that serves static files out of a public directory.ring.file-info: Middleware that augments response headers with info about File responses.ring.static: Middleware that serves static files with specified prefixes out of a public directory.ring.dump: Handler that dumps request maps as HTML responses for debugging.ring.show-exceptions: Middleware that catches exceptions and displays readable backtraces for debugging.ring.reload: Middleware to automatically reload selected libs before each requests, minimizing server restarts.ring.builder: Helpers for composing Ring apps from multiple handlers and middleware.ring.lint: Linter for the Ring interface, ensures compliance with the Ring spec.ring.examples.*: Various example Ring apps.
Development
Ring is being actively developed; you can track its progress and contribute at the project’s GitHub page.
To run all the Ring unit tests:
java -Djava.ext.dirs=deps clojure.main test/ring/run.clj
You can learn more about Ring’s dependencies at the following sites:
clojure.jar,clojure-contrib.jar: clojure.orgjetty-6.1.14.jar,jetty-util-6.1.14.jar,servlet-api-2.5-6.1.14.jar: mortbay.org/jettyhttpcore-4.0.jar,httpcore-nio-4.0.jar: hc.apache.orgcommons-io-1.4.jar: commons.apache.org/ioclj-html.jar,clj-html-helpers.jar,clj-backtrace.jar,clj-unit(testing): github.com/mmcgrana
Thanks
This project borrows heavily from Ruby’s Rack and Python’s WSGI, and I thank the communities developing and supporting those projects.
+--->HTTP Request--->[Adapter]--->Req1---->[Middleware]--->Req2----+
| |
[Client] [Handler]
| |
+----HTTP Response<--[Adapter]<---Resp2<---[Middleware]<---Resp1<--+
Copyright © 2009 Mark McGranaghan and released under an MIT license.
Clojure logo by Tom Hickey.







