Dancer2::Core::Context - handles everything proper to a request's context.
Reference to the Dancer2::Core::App object for the current application.
Read-only accessor to a PSGI environment hash.
A Dancer2::Core::Request object, built from the PSGI environment variable for this request.
A Dancer2::Core::Response object, used to set content, headers and HTTP status codes.
Handle for the current session object, if any
We cache a destroyed session here; once this is set we must not attempt to retrieve the session from the cookie in the request. If no new session is created, this is set (with expiration) as a cookie to force the browser to expire the cookie.
Used to cache the coderef from Return::MultiLevel within the dispatcher.
Returns a hashref of all per-request variables stored in this object.
By-name interface to variables stored in this context object.
my $stored = $context->var('some_variable');
returns the value of 'some_variable', while
$context->var('some_variable' => 'value');
will set it.
Shortcut that dispatches to Dancer2::Core::Request's cookies method.
Sets a redirect in the response object. If $destination is not an absolute URI, then it will be made into an absolute URI, relative to the URI in the request.
Flag the response object as 'halted'.
If called during request dispatch, immediatly returns the response to the dispatcher and after hooks will not be run.
Returns true if session engine has been defined and if either a session object has been instantiated in the context or if a session cookie was found and not subsequently invalidated.
Destroys the current session and ensures any subsequent session is created from scratch and not from the request session cookie
Dancer Core Developers
This software is copyright (c) 2013 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.