/** * Get a new RequestMatcher for the Request's ParentRequest * * @return \TYPO3\Flow\Mvc\RequestMatcher * @api */ public function getParentRequest() { if ($this->request === null || $this->request->isMainRequest()) { return new RequestMatcher(); } $this->addWeight(1000000); return new RequestMatcher($this->request->getParentRequest(), $this); }
/** * By design, the root request will always be an HTTP request because it is * the only of the two types which can be instantiated without having to pass * another request as the parent request. * * @test */ public function anHttpRequestOrActionRequestIsRequiredAsParentRequest() { $httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog')); $actionRequest = new ActionRequest($httpRequest); $this->assertSame($httpRequest, $actionRequest->getParentRequest()); $anotherActionRequest = new ActionRequest($actionRequest); $this->assertSame($actionRequest, $anotherActionRequest->getParentRequest()); }
/** * Get the path of the argument namespaces of all parent requests. * Example: mainrequest.subrequest.subsubrequest * * @param \TYPO3\Flow\Mvc\ActionRequest $request * @return string */ protected function getRequestNamespacePath($request) { if (!$request instanceof \TYPO3\Flow\Http\Request) { $parentPath = $this->getRequestNamespacePath($request->getParentRequest()); return $parentPath . ($parentPath !== '' && $request->getArgumentNamespace() !== '' ? '.' : '') . $request->getArgumentNamespace(); } return ''; }
/** * By design, the root request will always be an HTTP request because it is * the only of the two types which can be instantiated without having to pass * another request as the parent request. * * @test */ public function anHttpRequestOrActionRequestIsRequiredAsParentRequest() { $this->assertSame($this->mockHttpRequest, $this->actionRequest->getParentRequest()); $anotherActionRequest = new ActionRequest($this->actionRequest); $this->assertSame($this->actionRequest, $anotherActionRequest->getParentRequest()); }