SessionMiddleware class

Gives each request a session (req.session) and saves it after the controller. Settings come from AppConfig.session.

AppConfig(
  globalMiddleware: <dynamic>[SessionMiddleware(), CsrfMiddleware()],
);

With the cookie driver the data is read from the cookie on first use. With the cache driver the store is read before the controller, but only when the request has a session cookie. The cookie is sent only when the session changed.

Implemented types

Constructors

SessionMiddleware([SessionConfig? _config])
config wins over AppConfig.session.
const

Properties

config → SessionConfig
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

handle(DoxRequest req, Next next) → Future<DoxResponse>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

requestOf(HttpRequest req) → DoxRequest?
The request of req when it runs this middleware, else null. The ExceptionHandler uses it to redirect back with errors.

Constants

maxCookieSize → const int
cookie limit of the browsers, name and value together