public function getHeaders(ResponseBag $bag) { if (!$bag->has(self::FILENAME)) { throw new \Exception('Missing filename for streamed response'); } $bag->addHeader('X-Sendfile', $bag->get(self::FILENAME)); $bag->addHeader('X-Accel-Buffering', 'no'); $bag->addHeader('Transfer-Encoding', 'chunked'); $bag->addHeader('Content-Type', 'application/force-download'); $bag->addHeader('Content-Disposition', sprintf('%s; filename="%s"', $bag->get(self::ATTACHMENT_DISPOSITION, 'attachment'), $bag->get(self::FILENAME))); return $bag->getHeaders(); }
/** * @param $actionResult * @param ResponseBag $bag */ public function redirect($actionResult, ResponseBag $bag) { $redirectionPath = $bag->get(RedirectionFromBagLayer::REDIRECTION_BAG_KEY); $bag->setResultCode(Response::HTTP_FOUND); $bag->addHeader('Location', $redirectionPath); }
public function redirect($redirectionPath, ResponseBag $responseBag) { $responseBag->addHeader('Location', $redirectionPath); }