class Marten::Middleware::Session
- Marten::Middleware::Session
- Marten::Middleware
- Reference
- Object
Overview
Enables the use of sessions.
When this middleware is used, each request will have a session store initialized according to the sessions configuration. This session store is a hash-like object that allows to fetch or set values that are associated with specific keys.
The session store is initialized from a session key that is stored as a regular cookie. If the session store ends up being empty after a request's handling, the associated cookie is deleted. Otherwise if the session store is modified as part of the considered request the associated cookie is refreshed. Each session cookie is set to expire according to a configured cookie max age (the default cookie max age is 2 weeks).
Defined in:
marten/middleware/session.crInstance Method Summary
-
#call(request : Marten::HTTP::Request, get_response : Proc(Marten::HTTP::Response)) : Marten::HTTP::Response
Calls the middleware for a given HTTP request and returns a HTTP response.
Instance methods inherited from class Marten::Middleware
call(request : Marten::HTTP::Request, get_response : Proc(Marten::HTTP::Response)) : Marten::HTTP::Response
call,
next : Nil | Middleware
next,
next=(next __arg0 : Nil | Middleware)
next=
Instance Method Detail
Calls the middleware for a given HTTP request and returns a HTTP response.
This method must be implemented by subclasses: it takes a request
argument (the current HTTP request) and a
get_response
proc that allows to get the final response. This proc might actually call the next middleware in
the chain of configured middlewares, or the final matched handler. That way, the current middleware have the
ability to intercept any incoming request and the associated response, and to modify them if applicable.