forked from ring-clojure/ring
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: project.clj ring-core/project.clj ring-devel/project.clj ring-httpcore-adapter/project.clj ring-jetty-adapter/project.clj ring-servlet/project.clj
- Loading branch information
Showing
27 changed files
with
216 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
(defproject ring/ring-core "0.2.6" | ||
(defproject ring/ring-core "0.3.0-beta1" | ||
:description "Ring core libraries." | ||
:url "http://github.com/mmcgrana/ring" | ||
:dependencies [[org.clojure/clojure "1.1.0"] | ||
[org.clojure/clojure-contrib "1.1.0"] | ||
:dependencies [[org.clojure/clojure "1.2.0"] | ||
[org.clojure/clojure-contrib "1.2.0"] | ||
[commons-codec "1.4"] | ||
[commons-io "1.4"] | ||
[commons-fileupload "1.2.1"] | ||
[javax.servlet/servlet-api "2.5"]] | ||
:dev-dependencies [[lein-clojars "0.6.0"]]) | ||
:dev-dependencies [[lein-clojars "0.6.0"] | ||
[swank-clojure "1.2.1"]]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
(ns ring.middleware.session.memory | ||
"In-memory session storage." | ||
(:use ring.middleware.session.store) | ||
(:import java.util.UUID)) | ||
|
||
(deftype MemoryStore [session-map] | ||
SessionStore | ||
(read-session [_ key] | ||
(@session-map key {})) | ||
(write-session [_ key data] | ||
(let [key (or key (str (UUID/randomUUID)))] | ||
(swap! session-map assoc key data) | ||
key)) | ||
(delete-session [_ key] | ||
(swap! session-map dissoc key) | ||
nil)) | ||
|
||
(defn memory-store | ||
"Creates an in-memory session storage engine." | ||
[] | ||
(let [session-map (atom {})] | ||
{:read (fn [session-key] | ||
(@session-map session-key {})) | ||
:write (fn [session-key session] | ||
(let [session-key (or session-key (str (UUID/randomUUID)))] | ||
(swap! session-map assoc session-key session) | ||
session-key)) | ||
:delete (fn [session-key] | ||
(swap! session-map dissoc session-key) | ||
nil)})) | ||
(MemoryStore. (atom {}))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(ns ring.middleware.session.store | ||
"Common session store objects and functions.") | ||
|
||
(defprotocol SessionStore | ||
(read-session [store key] "Read a session map from the store.") | ||
(write-session [store key data] "Write a session map to the store.") | ||
(delete-session [store key] "Delete a session map from the store.")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.