protected function forwardToFormRequest(HttpServletRequestInterface $servletRequest, HttpServletResponseInterface $servletResponse)
{
// load the session from the request
$session = $servletRequest->getSession();
// initialize the location to redirect to
$location = '/';
// prepend the base modifier if available
if ($baseModifier = $servletRequest->getBaseModifier()) {
$location = $baseModifier;
}
// query whether or not we found the original request to redirect to
if ($session && $session->hasKey(Constants::FORM_REQUEST)) {
// load the original request
$req = $session->getData(Constants::FORM_REQUEST);
// initialize the location to redirect to
$location = $req->requestUri;
// prepare URI + query string to redirect to
if ($queryString = $req->queryString) {
$location .= '?' . $queryString;
}
}
// redirect to the original location
$servletRequest->setDispatched(true);
$servletResponse->setStatusCode(303);
$servletResponse->addHeader(Protocol::HEADER_LOCATION, $location);
}