Remove getStatus and setStatus in Session::Http, and replace them with status, from $session->status.
This commit is contained in:
parent
b830bd8e71
commit
e5adc07a05
27 changed files with 88 additions and 129 deletions
|
|
@ -615,7 +615,7 @@ sub www_view {
|
|||
# Check to make sure it's not in the trash or some other weird place
|
||||
if ($self->state ne "published") {
|
||||
my $i18n = WebGUI::International->new($session,'Asset_File');
|
||||
$session->http->setStatus(404);
|
||||
$session->response->status(404);
|
||||
return sprintf($i18n->get("file not found"), $self->getUrl());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ sub www_view {
|
|||
$self->session->http->setRedirect($self->getUrl("func=manageClipboard"));
|
||||
return undef;
|
||||
} else { # tell em it doesn't exist anymore
|
||||
$self->session->http->setStatus(410);
|
||||
$self->session->response->status(410);
|
||||
return WebGUI::Asset->getNotFound($self->session)->www_view;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1624,7 +1624,7 @@ sub www_deleteThingDataViaAjax {
|
|||
$session->http->setMimeType("application/json");
|
||||
|
||||
unless ($thingId && $thingDataId) {
|
||||
$session->http->setStatus(400);
|
||||
$session->response->status(400);
|
||||
return JSON->new->encode({message => "Can't get thing data without a thingId and a thingDataId."});
|
||||
}
|
||||
|
||||
|
|
@ -1639,7 +1639,7 @@ sub www_deleteThingDataViaAjax {
|
|||
return JSON->new->encode({message => "Data with thingDataId $thingDataId was deleted."});
|
||||
}
|
||||
else {
|
||||
$session->http->setStatus(404);
|
||||
$session->response->status(404);
|
||||
return JSON->new->encode({message => "The thingId you specified can not be found."});
|
||||
}
|
||||
}
|
||||
|
|
@ -2583,7 +2583,7 @@ sub www_editThingDataSaveViaAjax {
|
|||
my $i18n = WebGUI::International->new($self->session, "Asset_Thingy");
|
||||
|
||||
unless ($thingId && $thingDataId) {
|
||||
$session->http->setStatus(400);
|
||||
$session->response->status(400);
|
||||
return JSON->new->encode({message => "Can't get thing data without a thingId and a thingDataId."});
|
||||
}
|
||||
|
||||
|
|
@ -2593,22 +2593,22 @@ sub www_editThingDataSaveViaAjax {
|
|||
,$thingProperties);
|
||||
|
||||
if($thingDataId eq 'new' && $self->hasEnteredMaxPerUser($thingId)){
|
||||
$session->http->setStatus(400);
|
||||
$session->response->status(400);
|
||||
return JSON->new->encode({message => $i18n->get("has entered max per user message")});
|
||||
}
|
||||
|
||||
my ($newThingDataId,$errors) = $self->editThingDataSave($thingId,$thingDataId);
|
||||
|
||||
if (@{ $errors }) {
|
||||
$session->http->setStatus(400);
|
||||
$session->response->status(400);
|
||||
return JSON->new->encode($errors);
|
||||
}
|
||||
$session->http->setStatus("200");
|
||||
$session->response->status("200");
|
||||
return '{}';
|
||||
}
|
||||
else {
|
||||
$session->log->warn("thingId ".$thingProperties->{thingId}." not found in thingProperties");
|
||||
$session->http->setStatus(404);
|
||||
$session->response->status(404);
|
||||
return JSON->new->encode({message => "The thingId you requested can not be found."});
|
||||
}
|
||||
}
|
||||
|
|
@ -2707,7 +2707,7 @@ sub www_getThingViaAjax {
|
|||
$session->http->setMimeType("application/json");
|
||||
|
||||
unless ($thingId) {
|
||||
$session->http->setStatus(400);
|
||||
$session->response->status(400);
|
||||
return JSON->new->encode({message => "Can't return thing properties without a thingId."});
|
||||
}
|
||||
|
||||
|
|
@ -2729,7 +2729,7 @@ sub www_getThingViaAjax {
|
|||
return JSON->new->encode($thingProperties);
|
||||
}
|
||||
else {
|
||||
$session->http->setStatus(404);
|
||||
$session->response->status(404);
|
||||
return JSON->new->encode({message => "The thingId you requested can not be found."});
|
||||
}
|
||||
}
|
||||
|
|
@ -2763,7 +2763,7 @@ sub www_getThingsViaAjax {
|
|||
return JSON->new->encode(\@visibleThings);
|
||||
}
|
||||
else {
|
||||
$session->http->setStatus(404);
|
||||
$session->response->status(404);
|
||||
return JSON->new->encode({message => "No visible Things were found in this Thingy."});
|
||||
}
|
||||
}
|
||||
|
|
@ -3123,7 +3123,7 @@ sub www_searchViaAjax {
|
|||
my $i18n = WebGUI::International->new($self->session,"Asset_Thingy");
|
||||
|
||||
unless ($thingId) {
|
||||
$session->http->setStatus(400);
|
||||
$session->response->status(400);
|
||||
return JSON->new->encode({message => "Can't perform search without a thingId."});
|
||||
}
|
||||
|
||||
|
|
@ -3138,7 +3138,7 @@ sub www_searchViaAjax {
|
|||
return JSON->new->encode($var);
|
||||
}
|
||||
else {
|
||||
$session->http->setStatus(404);
|
||||
$session->response->status(404);
|
||||
return JSON->new->encode({message => "The thingId you requested can not be found."});
|
||||
}
|
||||
}
|
||||
|
|
@ -3557,7 +3557,7 @@ sub www_viewThingDataViaAjax {
|
|||
$session->http->setMimeType("application/json");
|
||||
|
||||
unless ($thingId && $thingDataId) {
|
||||
$session->http->setStatus(400);
|
||||
$session->response->status(400);
|
||||
return JSON->new->encode({message => "Can't get thing data without a thingId and a thingDataId."});
|
||||
}
|
||||
|
||||
|
|
@ -3572,12 +3572,12 @@ sub www_viewThingDataViaAjax {
|
|||
return JSON->new->encode($output);
|
||||
}
|
||||
else{
|
||||
$session->http->setStatus(404);
|
||||
$session->response->status(404);
|
||||
return JSON->new->encode({message => "The thingDataId you requested can not be found."});
|
||||
}
|
||||
}
|
||||
else {
|
||||
$session->http->setStatus(404);
|
||||
$session->response->status(404);
|
||||
return JSON->new->encode({message => "The thingId you requested can not be found."});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue