Remove status description from Session/Http, and update all users of setStatus.
This commit is contained in:
parent
4cf75513d3
commit
19c2c5fa1c
16 changed files with 50 additions and 85 deletions
|
|
@ -44,8 +44,6 @@ This package allows the manipulation of HTTP protocol information.
|
|||
|
||||
$mimetype = $http->getMimeType();
|
||||
$code = $http->getStatus();
|
||||
($code, $description) = $http->getStatus();
|
||||
$description = $http->getStatusDescription();
|
||||
$boolean = $http->isRedirect();
|
||||
|
||||
$http->setCookie($name,$value);
|
||||
|
|
@ -152,27 +150,11 @@ the code returned will be 200.
|
|||
|
||||
sub getStatus {
|
||||
my $self = shift;
|
||||
$self->{_http}{statusDescription} = $self->{_http}{statusDescription} || "OK";
|
||||
my $status = $self->{_http}{status} || "200";
|
||||
return $status;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getStatusDescription ( ) {
|
||||
|
||||
Returns the current HTTP status description. If no description has
|
||||
been set, "OK" will be returned.
|
||||
|
||||
=cut
|
||||
|
||||
sub getStatusDescription {
|
||||
my $self = shift;
|
||||
return $self->{_http}{statusDescription} || "OK";
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getStreamedFile ( ) {
|
||||
|
|
@ -316,7 +298,6 @@ sub sendHeader {
|
|||
$response->header( 'Content-Disposition' => qq{attachment; filename="}.$self->getFilename().'"');
|
||||
}
|
||||
$response->status($self->getStatus());
|
||||
# $response->status_line($self->getStatus().' '.$self->getStatusDescription()); # TODO - re-enable
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
|
@ -331,7 +312,6 @@ sub _sendMinimalHeader {
|
|||
"Cache-Control" => "no-cache",
|
||||
);
|
||||
$response->status($self->getStatus());
|
||||
# $response->status_line($self->getStatus().' '.$self->getStatusDescription()); # TODO - re-enable
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
|
@ -527,7 +507,7 @@ sub setRedirect {
|
|||
return undef if ($url eq $self->session->url->page() && scalar(@params) < 1); # prevent redirecting to self
|
||||
$self->session->errorHandler->info("Redirecting to $url");
|
||||
$self->setRedirectLocation($url);
|
||||
$self->setStatus($type, "Redirect");
|
||||
$self->setStatus($type);
|
||||
$self->session->style->setMeta({"http-equiv"=>"refresh",content=>"0; URL=".$url});
|
||||
}
|
||||
|
||||
|
|
@ -547,7 +527,7 @@ sub setRedirectLocation {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setStatus ( code, description )
|
||||
=head2 setStatus ( code )
|
||||
|
||||
Sets the HTTP status code.
|
||||
|
||||
|
|
@ -555,16 +535,11 @@ Sets the HTTP status code.
|
|||
|
||||
An HTTP status code. It is a 3 digit status number.
|
||||
|
||||
=head3 description
|
||||
|
||||
An HTTP status code description. It is a little one line of text that describes the status code.
|
||||
|
||||
=cut
|
||||
|
||||
sub setStatus {
|
||||
my $self = shift;
|
||||
$self->{_http}{status} = shift;
|
||||
$self->{_http}{statusDescription} = shift;
|
||||
my $self = shift;
|
||||
$self->{_http}{status} = shift;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ Returns a message stating that this functionality can only be used by administra
|
|||
sub adminOnly {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$self->session->http->setStatus("401", "Admin Only");
|
||||
$self->session->http->setStatus(401);
|
||||
my $output = '<h1>'.$i18n->get(35).'</h1>';
|
||||
$output .= $i18n->get(36);
|
||||
return $self->session->style->userStyle($output);
|
||||
|
|
@ -77,7 +77,7 @@ sub insufficient {
|
|||
my $self = shift;
|
||||
my $noStyle = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$self->session->http->setStatus("401", "Insufficient Privileges");
|
||||
$self->session->http->setStatus(401);
|
||||
my $output = '<h1>'.$i18n->get(37).'</h1>';
|
||||
if ($noStyle) {
|
||||
$self->session->style->useEmptyStyle(1);
|
||||
|
|
@ -102,7 +102,7 @@ sub locked {
|
|||
my $self = shift;
|
||||
my $noStyle = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$self->session->http->setStatus("401", "Insufficient Privileges");
|
||||
$self->session->http->setStatus(401);
|
||||
my $output = '<h1>'.$i18n->get(37).'</h1>';
|
||||
if ($noStyle) {
|
||||
$self->session->style->useEmptyStyle(1);
|
||||
|
|
@ -147,7 +147,7 @@ Returns a message stating that the user does not have the privileges necessary t
|
|||
|
||||
sub noAccess {
|
||||
my $self = shift;
|
||||
$self->session->http->setStatus("401", "No Access");
|
||||
$self->session->http->setStatus(401);
|
||||
if ($self->session->user->isVisitor) {
|
||||
return WebGUI::Operation::Auth::www_auth($self->session, "init");
|
||||
} else {
|
||||
|
|
@ -170,7 +170,7 @@ Returns a message stating that the user they requested information about is no l
|
|||
sub notMember {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$self->session->http->setStatus("400", "Not A Member");
|
||||
$self->session->http->setStatus(400);
|
||||
my ($output);
|
||||
$output = '<h1>'.$i18n->get(345).'</h1>';
|
||||
$output .= $i18n->get(346);
|
||||
|
|
@ -202,7 +202,7 @@ Returns a message stating that the user made a request to delete something that
|
|||
sub vitalComponent {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$self->session->http->setStatus("403", "Vital Component");
|
||||
$self->session->http->setStatus(403);
|
||||
my ($output);
|
||||
$output = '<h1>'.$i18n->get(40).'</h1>';
|
||||
$output .= $i18n->get(41);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue