Пример #1
0
 public final function sendResponse(Application\IResponse $response)
 {
     if ($this->innerCall) {
         parent::sendResponse($response);
     }
     $this->amfManager->setResponse($response);
     if ($this->amfManager->hasMoreMessages()) {
         $request = $this->amfManager->createApplicationRequest();
         parent::sendResponse(new Application\Responses\ForwardResponse($request));
     } else {
         parent::sendResponse(new FinalResponse($this->amfManager));
     }
 }
Пример #2
0
 /**
  * Maps HTTP request to a Request object.
  * @return Nette\Application\Request|NULL
  */
 public function match(Nette\Http\IRequest $httpRequest)
 {
     // combine with precedence: mask (params in URL-path), fixity, query, (post,) defaults
     // 1) URL MASK
     $url = $httpRequest->getUrl();
     $re = $this->re;
     if ($this->type === self::HOST) {
         $path = '//' . $url->getHost() . $url->getPath();
         $host = array_reverse(explode('.', $url->getHost()));
         $re = strtr($re, array('/%basePath%/' => preg_quote($url->getBasePath(), '#'), '%tld%' => $host[0], '%domain%' => isset($host[1]) ? "{$host['1']}\\.{$host['0']}" : $host[0]));
     } elseif ($this->type === self::RELATIVE) {
         $basePath = $url->getBasePath();
         if (strncmp($url->getPath(), $basePath, strlen($basePath)) !== 0) {
             return NULL;
         }
         $path = (string) substr($url->getPath(), strlen($basePath));
     } else {
         $path = $url->getPath();
     }
     if ($path !== '') {
         $path = rtrim($path, '/') . '/';
     }
     if (!($matches = Strings::match($path, $re))) {
         // stop, not matched
         return NULL;
     }
     if (!$this->manager->isAMFRequest()) {
         return null;
     }
     return $this->manager->createApplicationRequest();
 }