public function respond(Response $response)
 {
     $fullClassName = $this->pageClass->getFullyQualifiedName();
     $page = new $fullClassName();
     $page->renderPage();
     $response->flush();
 }
 public function respond(Response $response)
 {
     $fullClassName = $this->getPageClass()->getFullyQualifiedName();
     $page = new $fullClassName();
     $page->beforePageRender();
     $listener = null;
     if ($this->behaviour == null) {
         $listener = $page->get($this->componentPath);
     } else {
         $component = $page->get($this->componentPath);
         if ($component != null && $component instanceof Component) {
             $listener = $component->getBehaviourById($this->behaviour);
         }
     }
     if ($listener == null) {
         throw new \RuntimeException(sprintf("Listener component %s was not found", $this->componentPath));
     }
     $listener->onEvent();
     $page->renderPage();
     $response->flush();
 }
    }
    $oResponse->setData($result);
    $oResponse->flushJson();
}
if (Request::getApiParam('mode') === 'addfolder') {
    $path = Request::getApiParam('path');
    $name = Request::getApiParam('name');
    $result = $oFtp->mkdir($path . '/' . $name);
    if (!$result) {
        throw new Exception("Unknown error creating this folder");
    }
    $oResponse->setData($result);
    $oResponse->flushJson();
}
if (Request::getApiParam('mode') === 'compress' || Request::getApiParam('mode') === 'extract') {
    $oResponse->setData(true);
    $oResponse->flushJson();
}
if (Request::getQuery('mode') === 'download') {
    $download = Request::getQuery('preview') === 'true' ? '' : 'attachment;';
    $filePath = Request::getQuery('path');
    $fileName = explode('/', $filePath);
    $fileName = end($fileName);
    $tmpFilePath = $oFtp->downloadTemp($filePath);
    if ($fileContent = @file_get_contents($tmpFilePath)) {
        $oResponse->setData($fileContent);
        $oResponse->setHeaders(array('Content-Type' => @mime_content_type($tmpFilePath), 'Content-disposition' => sprintf('%s filename="%s"', $download, $fileName)));
    }
    $oResponse->flush();
}
throw new \Exception('This action is not available in the demo');
 public function respond(Response $response)
 {
     $response->clean();
     $response->setHeader('Location: ' . $this->url, 301);
     $response->flush();
 }
 public function respond(Response $response)
 {
     $this->page->renderPage();
     $response->flush();
 }
 public function respond(Response $response)
 {
     $page = new PageNotFoundPage();
     $page->render();
     $response->flush();
 }
 public function respond(Response $response)
 {
     $page = new \ErrorPage($this->exception);
     $page->renderPage();
     $response->flush();
 }