Added pluggable URL and content handlers.
This commit is contained in:
parent
fb33859cc6
commit
1fc11fbda8
19 changed files with 1101 additions and 411 deletions
|
|
@ -564,9 +564,6 @@ sub fixUrl {
|
|||
$self->session->config->get("extrasURL"),
|
||||
$self->session->config->get("uploadsURL"),
|
||||
);
|
||||
if (defined $self->session->config->get('passthruUrls')) {
|
||||
push @badUrls, @{ $self->session->config->get('passthruUrls') };
|
||||
}
|
||||
foreach my $badUrl (@badUrls) {
|
||||
$badUrl =~ s{ / $ }{}x; # Remove trailing slashes from the end of the URL
|
||||
if ($badUrl =~ /^http/) {
|
||||
|
|
@ -1083,25 +1080,7 @@ A reference to the current session.
|
|||
sub getNotFound {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
if ($session->url->getRequestedUrl eq "*give-credit-where-credit-is-due*") {
|
||||
my $content = "";
|
||||
open(my $FILE,"<",$session->config->getWebguiRoot."/docs/credits.txt");
|
||||
while (<$FILE>) {
|
||||
$content .= $_;
|
||||
}
|
||||
close($FILE);
|
||||
return WebGUI::Asset->newByPropertyHashRef($session,{
|
||||
className=>"WebGUI::Asset::Snippet",
|
||||
snippet=> '<pre>'.$content.'</pre>'
|
||||
});
|
||||
} elsif ($session->url->getRequestedUrl eq "abcdefghijklmnopqrstuvwxyz") {
|
||||
return WebGUI::Asset->newByPropertyHashRef($session,{
|
||||
className=>"WebGUI::Asset::Snippet",
|
||||
snippet=>q|<div style="width: 600px; padding: 200px;">Why would you type in this URL? Really. What were you expecting to see here? You really need to get a life. Are you still here? Seriously, you need to go do something else. I think your boss is calling.</div>|
|
||||
});
|
||||
} else {
|
||||
return WebGUI::Asset->newByDynamicClass($session, $session->setting->get("notFoundPage"));
|
||||
}
|
||||
return WebGUI::Asset->newByDynamicClass($session, $session->setting->get("notFoundPage"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue