throw new AccessDeniedHttpException('PageController can\'t be requested via XmlHttpRequest.'
);
} // used to switch session token - when the context token expired
public function replaceContextToken(SalesChannelContextResolvedEvent
$event): void
{ $context =
$event->
getSalesChannelContext();
// only update session if token expired and switched
if ($event->
getUsedToken() ===
$context->
getToken()) { return;
} $this->
updateSession($context->
getToken());
} public function setCanonicalUrl(BeforeSendResponseEvent
$event): void
{ if (!
$event->
getResponse()->
isSuccessful()) { return;
}