WebGUI::Session::Http should go away (#11647)

Move logic out of WebGUI::Session::HTTP and into WebGUI::Session::Response /
::Request; deprecate more functions; change references in core to use
$session->response instead; fix tests that broke because of the change but
not one that merely generate the deprecated warning because I want to know
that the proxying of depricated methods is working.  These can be changed later.
This commit is contained in:
Scott Walters 2011-05-11 16:17:54 -04:00
parent 72bac90f93
commit 57d2dbed56
76 changed files with 581 additions and 358 deletions

View file

@ -433,7 +433,7 @@ See WebGUI::Asset::Wobject::www_view() for details.
override www_view => sub {
my $self = shift;
$self->session->http->setCacheControl($self->cacheTimeout);
$self->session->response->setCacheControl($self->cacheTimeout);
super();
};

View file

@ -1776,7 +1776,7 @@ Extend the base method to handle the visitor cache timeout.
sub www_view {
my $self = shift;
my $disableCache = ($self->session->form->process("sortBy") ne "");
$self->session->http->setCacheControl($self->visitorCacheTimeout) if ($self->session->user->isVisitor && !$disableCache);
$self->session->response->setCacheControl($self->visitorCacheTimeout) if ($self->session->user->isVisitor && !$disableCache);
return $self->next::method(@_);
}

View file

@ -460,10 +460,10 @@ sub www_view {
if ($self->state eq "published") { # no privileges, make em log in
return $self->session->privilege->noAccess();
} elsif ($self->session->isAdminOn && $self->state =~ /^trash/) { # show em trash
$self->session->http->setRedirect($self->getUrl("func=manageTrash"));
$self->session->response->setRedirect($self->getUrl("func=manageTrash"));
return undef;
} elsif ($self->session->isAdminOn && $self->state =~ /^clipboard/) { # show em clipboard
$self->session->http->setRedirect($self->getUrl("func=manageClipboard"));
$self->session->response->setRedirect($self->getUrl("func=manageClipboard"));
return undef;
} else { # tell em it doesn't exist anymore
$self->session->response->status(410);

View file

@ -1339,7 +1339,7 @@ sub viewForm {
}
$var = $passedVars || $self->getRecordTemplateVars($var, $entry);
if ($self->hasCaptcha) {
$self->session->http->setCacheControl('none');
$self->session->response->setCacheControl('none');
}
return $self->processTemplate($var, undef, $self->{_viewFormTemplate});
}
@ -1889,7 +1889,7 @@ sub www_exportTab {
$session->response->header( 'Content-Disposition' => qq{attachment; filename="}.$self->url.'.tab"');
$session->response->content_type('text/plain');
$session->http->sendHeader;
$session->response->sendHeader;
$session->output->print($tsv->string, 1);
my $entryIter = $self->entryClass->iterateAll($self);

View file

@ -282,7 +282,7 @@ See WebGUI::Asset::Wobject::www_view() for details.
override www_view => sub {
my $self = shift;
$self->session->http->setCacheControl($self->visitorCacheTimeout) if ($self->session->user->isVisitor);
$self->session->response->setCacheControl($self->visitorCacheTimeout) if ($self->session->user->isVisitor);
super();
};

View file

@ -837,8 +837,8 @@ sub sendChunkedContent {
my $session = $self->session;
$session->http->setLastModified($self->getContentLastModified);
$session->http->sendHeader;
$session->response->setLastModified($self->getContentLastModified);
$session->response->sendHeader;
my $style = $self->processStyle($self->getSeparator);
my ($head, $foot) = split($self->getSeparator,$style);
$session->output->print($head, 1);

View file

@ -497,7 +497,7 @@ sub www_view {
if ($self->session->response->content_type ne "text/html") {
return $output;
} else {
$self->session->http->sendHeader;
$self->session->response->sendHeader;
my $style = $self->processStyle($self->getSeparator, { noHeadTags => 1 });
my ($head, $foot) = split($self->getSeparator,$style);
$self->session->output->print($head);

View file

@ -396,8 +396,8 @@ override www_view => sub {
my $ad = $adSpace->displayImpression if (defined $adSpace);
$out =~ s/\Q$code/$ad/ges;
}
$session->http->setLastModified($self->getContentLastModified);
$session->http->sendHeader;
$session->response->setLastModified($self->getContentLastModified);
$session->response->sendHeader;
$session->output->print($out, 1);
return "chunked";
}

View file

@ -1080,7 +1080,7 @@ sub www_exportAttributes {
$session->response->header( 'Content-Disposition' => qq{attachment; filename="export_matrix_attributes.csv"});
$session->response->content_type('application/octet-stream');
$self->session->http->sendHeader;
$self->session->response->sendHeader;
return $output;
}

View file

@ -178,7 +178,7 @@ See WebGUI::Asset::Wobject::www_view() for details.
override www_view => sub {
my $self = shift;
$self->session->http->setCacheControl($self->visitorCacheTimeout) if ($self->session->user->isVisitor);
$self->session->response->setCacheControl($self->visitorCacheTimeout) if ($self->session->user->isVisitor);
super();
};

View file

@ -128,7 +128,7 @@ See WebGUI::Asset::Wobject::www_view() for details.
override www_view => sub {
my $self = shift;
$self->session->http->setCacheControl($self->cacheTimeout);
$self->session->response->setCacheControl($self->cacheTimeout);
super();
};

View file

@ -504,7 +504,7 @@ Do a redirect to the form parameter returnUrl if it exists.
sub www_goBackToPage {
my $self = shift;
$self->session->http->setRedirect($self->session->form->process("returnUrl")) if ($self->session->form->process("returnUrl"));
$self->session->response->setRedirect($self->session->form->process("returnUrl")) if ($self->session->form->process("returnUrl"));
return undef;
}

View file

@ -704,7 +704,7 @@ sub www_download {
$self->downloadType eq 'csv' ? "application/octet-stream" : $self->downloadMimeType
);
$self->session->http->sendHeader;
$self->session->response->sendHeader;
return $self->download;
@ -722,7 +722,7 @@ See WebGUI::Asset::Wobject::www_view() for details.
override www_view => sub {
my $self = shift;
$self->session->http->setCacheControl($self->cacheTimeout);
$self->session->response->setCacheControl($self->cacheTimeout);
super();
};

View file

@ -390,7 +390,7 @@ See WebGUI::Asset::Wobject::www_view() for details.
override www_view => sub {
my $self = shift;
$self->session->http->setCacheControl($self->cacheTimeout);
$self->session->response->setCacheControl($self->cacheTimeout);
super();
};