Amon2で404ページを変更する。
2015年1月25日
MyApp.pmに書いたものは、$c->で呼べるようになるんで、元々ある$c->res_404を上書きする感じで。
sub res_404 {
my $self = shift;
my $html = $self->create_view()->render('error.tx');
$html = $self->encode_html($html);
return $self->create_response(
404,
[
'Content-Type' => $self->html_content_type,
'Content-Length' => length($html)
],
$html,
);
}
ま、Amon2::Web->renderをほぼコピっただけですが。