Amon2::Web - Web Application Base.
package MyApp;
use parent qw/Amon2/;
package MyApp::Web;
use parent qw/MyApp Amon2::Web/;
This is a web application base class.
- "$c->create_request()"
- Create new request object from $c.
You can override this method to change request object's
class.
- "$c->create_response($code, \@headers, \@body)"
- Create new response object.
You can override this method to change response object's
class.
- "$c->create_view()"
- Create new view object. View object should have
"$view->render(@_)" method.
You can override this method to change view object's
class.
- "$c->dispatch() : Plack::Response"
- Do dispatch request. This method must return instance of Plack::Response.
You can override this method to change behavior.
- "$c->html_content_type() : Str"
- Returns default Content-Type value for the HTML response.
You can override this method to change behavior.
- "$c->request() : Plack::Request"
- "$c->req() : Plack::Request"
- This is a accessor method to get the request object in this context.
- "$c->redirect($location : Str, \%parameters) :
Plack::Response"
- Create a response object to redirect for $location
with "\%parameters".
$c->redirect('/foo', +{bar => 3})
is same as following(if base URL is
http://localhost:5000/)
$c->create_response(302, [Location => 'http://localhost:5000/foo?bar=3'])
- "$c->res_403()"
- Create new response object which has 403 status code.
- "$c->res_404()"
- Create new response object which has 404 status code.
- "$c->res_405()"
- Create new response object which has 405 status code.
- "$c->create_simple_status_page($code, $message)"
- Create a new response object which represents specified status code.
- "MyApp->to_app() : CodeRef"
- Create an instance of PSGI application.
- "$c->uri_for($path: Str, \%args) : Str"
- Create URI from $path and
"\%args".
This method returns relative URI.
- "$c->render($tmpl[, @args|%args]) :
Plack::Web::Response"
- This method renders HTML.
- "$c->encoding()"
- Return a encoding object using
"Encode::find_encoding()".
You can override this method to change behavior.
- "$c->encode_html($html) : Str"
- This method encodes HTML from bytes.
You can override this method to change behavior.