public function redirectLocation(Request $request)
{
if (!$request->query->has('id') && !$request->query->has('remoteId')) {
throw new BadRequestException("At least one of 'id' or 'remoteId' parameters is required.");
}
if ($request->query->has('id')) {
$location = $this->locationService->loadLocation($request->query->get('id'));
} else {
$location = $this->locationService->loadLocationByRemoteId($request->query->get('remoteId'));
}
return new Values\TemporaryRedirect($this->router->generate('ezpublish_rest_loadLocation', array('locationPath' => trim($location->pathString, '/'))));
}