@@ 209-221 (lines=13) @@ | ||
206 | * @param Request $request |
|
207 | * @param Response $response |
|
208 | */ |
|
209 | private function storeTurbolinksLocationInSession(Request $request, Response $response) |
|
210 | { |
|
211 | // Stores the return value (the redirect target url) to persist through to the redirect |
|
212 | // request, where it will be used to set the Turbolinks-Location response header. The |
|
213 | // Turbolinks script will detect the header and use replaceState to reflect the redirected |
|
214 | // url. |
|
215 | $session = $request->getSession(); |
|
216 | ||
217 | if ($session) { |
|
218 | $location = $response->headers->get(self::ORIGIN_RESPONSE_HEADER); |
|
219 | $session->set(self::LOCATION_SESSION_ATTR_NAME, $location); |
|
220 | } |
|
221 | } |
|
222 | ||
223 | /** |
|
224 | * @param Request $request |
|
@@ 239-249 (lines=11) @@ | ||
236 | * @param Request $request |
|
237 | * @param Response $response |
|
238 | */ |
|
239 | private function setTurbolinksLocationHeaderFromSession(Request $request, Response $response) |
|
240 | { |
|
241 | $session = $request->getSession(); |
|
242 | ||
243 | // set 'Turbolinks-Location' header |
|
244 | if ($session && $session->has(self::LOCATION_SESSION_ATTR_NAME)) { |
|
245 | $response->headers->add( |
|
246 | array(self::REDIRECT_RESPONSE_HEADER => $session->remove(self::LOCATION_SESSION_ATTR_NAME)) |
|
247 | ); |
|
248 | } |
|
249 | } |
|
250 | ||
251 | /** |
|
252 | * @param ResponseHeaderBag $headers |