Dear Aaron, et al.,

I have been wrapping my sessions. Perhaps there's something I'm
missing???

(def app
    (-> #'main-routes
        (wrap-reload '(SocialNetworkCore.core))  ;;remove wrap-reload
from production code
        (wrap-params)               ;; wraps params (inputs from
forms) - makes 'em available
        ;(wrap-flash)                ;;
        (wrap-session)              ;; wraps session
        (wrap-request-logging)      ;; gives me request logging
        (wrap-bounce-favicon)       ;; skirts favicon request logging
        (wrap-exception-logging)    ;; logs exceptions
        (wrap-stacktrace)))         ;; detailed stacktrace of errors

I'm using compojure's defroutes, as well. Let me know if you spot
anything that I may be missing, eh.

Thanks,

shree

On May 11, 7:32 pm, Aaron Cohen <aa...@assonance.org> wrote:
> The "magic" is in wrap-session, which adds the session middleware to your 
> stack.
>
> At that point, your ring handler will see that it's request map has a
> new key (:session) which is a map containing all your session
> variables.
>
> You can assoc anything into that map and it will be stored in the session.
>
> By default, this is all stored in-memory, it's possible to use a
> database instead if you specify options to wrap-session.
>
> See (doc wrap-session) 
> orhttp://clojuredocs.org/ring/ring.middleware.session/wrap-session
>
> From your gist:
>
> ; The next line is using destructuring to split out the session map
> into a local variable named "session".
> (defn handler [{session :session, uri :uri}]
> ; The next line is reading the ":n" value out of the session map.
>   (let [n (session :n 1)]

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to