本文整理汇总了PHP中TYPO3\Flow\Http\Request::createActionRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::createActionRequest方法的具体用法?PHP Request::createActionRequest怎么用?PHP Request::createActionRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Http\Request
的用法示例。
在下文中一共展示了Request::createActionRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startAuthentication
/**
* Starts the authentication: Redirect to login page
*
* @param \TYPO3\Flow\Http\Request $request The current request
* @param \TYPO3\Flow\Http\Response $response The current response
* @return void
* @throws MissingConfigurationException
*/
public function startAuthentication(Request $request, Response $response)
{
if (isset($this->options['routeValues'])) {
$routeValues = $this->options['routeValues'];
if (!is_array($routeValues)) {
throw new MissingConfigurationException(sprintf('The configuration for the WebRedirect authentication entry point is incorrect. "routeValues" must be an array, got "%s".', gettype($routeValues)), 1345040415);
}
$actionRequest = $request->createActionRequest();
$this->uriBuilder->setRequest($actionRequest);
$actionName = $this->extractRouteValue($routeValues, '@action');
$controllerName = $this->extractRouteValue($routeValues, '@controller');
$packageKey = $this->extractRouteValue($routeValues, '@package');
$subPackageKey = $this->extractRouteValue($routeValues, '@subpackage');
$uri = $this->uriBuilder->setCreateAbsoluteUri(TRUE)->uriFor($actionName, $routeValues, $controllerName, $packageKey, $subPackageKey);
} elseif (isset($this->options['uri'])) {
$uri = strpos($this->options['uri'], '://') !== FALSE ? $this->options['uri'] : $request->getBaseUri() . $this->options['uri'];
} else {
throw new MissingConfigurationException('The configuration for the WebRedirect authentication entry point is incorrect or missing. You need to specify either the target "uri" or "routeValues".', 1237282583);
}
$response->setContent(sprintf('<html><head><meta http-equiv="refresh" content="0;url=%s"/></head></html>', htmlentities($uri, ENT_QUOTES, 'utf-8')));
$response->setStatus(303);
$response->setHeader('Location', $uri);
}
示例2: route
/**
* Routes the specified web request by setting the controller name, action and possible
* parameters. If the request could not be routed, it will be left untouched.
*
* @param \TYPO3\Flow\Http\Request $httpRequest The web request to be analyzed. Will be modified by the router.
* @return \TYPO3\Flow\Mvc\ActionRequest
*/
public function route(Request $httpRequest)
{
$this->actionRequest = $httpRequest->createActionRequest();
$matchResults = $this->findMatchResults($httpRequest);
if ($matchResults !== NULL) {
$requestArguments = $this->actionRequest->getArguments();
$mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
$this->actionRequest->setArguments($mergedArguments);
}
$this->setDefaultControllerAndActionNameIfNoneSpecified();
return $this->actionRequest;
}