Middlewareλ︎
Apply common transformations to request and or response hash-maps, such as security tokens, cookie management, session and access management, presentation templates, etc.
Middleware is implemented by Clojure functions that receive a handler as an argument and return a handler as a result.
Middleware in Ringλ︎
Middleware can wrap handlers or other middleware, affecting their behavior.
For example the wrap-reload
middleware enables live reloading by detecting file changes and reloading affected functions into their namespace, before the request is passed to the relevant handler function
Middleware provided by Ring includes:
In ring/ring-core
:
- wrap-cookies (ring.middleware.cookies)
- wrap-file (ring.middleware.file)
- wrap-file-info (ring.middleware.file-info)
- wrap-flash (ring.middleware.flash)
- wrap-keyword-params (ring.middleware.keyword-params)
- wrap-multipart-params (ring.middleware.multipart-params
- wrap-nested-params (ring.middleware.nested-params
- wrap-params (ring.middleware.params)
- wrap-session (ring.middleware.session)
In ring/ring-devel
:
- wrap-lint (ring.middleware.lint)
- wrap-reload (ring.middleware.reload)
- wrap-stacktrace (ring.middleware.stacktrace)