‪TYPO3CMS  9.5
FrontendRequestHandler.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 {
26  protected ‪$configurationManager;
27 
31  protected ‪$extensionService;
32 
36  protected ‪$cacheHashEnforcer;
37 
42  {
43  $this->configurationManager = ‪$configurationManager;
44  }
45 
49  public function ‪injectExtensionService(\‪TYPO3\CMS\‪Extbase\Service\ExtensionService ‪$extensionService)
50  {
51  $this->extensionService = ‪$extensionService;
52  }
53 
58  {
59  $this->cacheHashEnforcer = ‪$cacheHashEnforcer;
60  }
61 
67  public function ‪handleRequest()
68  {
69  $request = $this->requestBuilder->build();
70  if ($this->extensionService->isActionCacheable(null, null, $request->getControllerName(), $request->getControllerActionName())) {
71  $request->setIsCached(true);
72  } else {
73  $contentObject = $this->configurationManager->getContentObject();
74  if ($contentObject->getUserObjectType() === \‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::OBJECTTYPE_USER) {
75  $contentObject->convertToUserIntObject();
76  // \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::convertToUserIntObject() will recreate the object, so we have to stop the request here
77  return null;
78  }
79  $request->setIsCached(false);
80  }
81 
82  if ($this->configurationManager->isFeatureEnabled('requireCHashArgumentForActionArguments')) {
83  $pluginNamespace = $this->extensionService->getPluginNamespace(
84  $request->getControllerExtensionName(),
85  $request->getPluginName()
86  );
87  $this->cacheHashEnforcer->enforceForRequest($request, $pluginNamespace);
88  }
89 
91  $response = $this->objectManager->get(\‪TYPO3\CMS\‪Extbase\Mvc\Web\Response::class);
92  $this->dispatcher->dispatch($request, $response);
93  return $response;
94  }
95 
101  public function ‪canHandleRequest()
102  {
103  return $this->environmentService->isEnvironmentInFrontendMode();
104  }
105 }
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\handleRequest
‪TYPO3 CMS Extbase Mvc ResponseInterface null handleRequest()
Definition: FrontendRequestHandler.php:64
‪TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer
Definition: CacheHashEnforcer.php:27
‪TYPO3\CMS\Extbase\Annotation
Definition: IgnoreValidation.php:4
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\canHandleRequest
‪bool canHandleRequest()
Definition: FrontendRequestHandler.php:98
‪TYPO3
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:22
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\injectConfigurationManager
‪injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
Definition: FrontendRequestHandler.php:38
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\$cacheHashEnforcer
‪TYPO3 CMS Extbase Mvc Web CacheHashEnforcer $cacheHashEnforcer
Definition: FrontendRequestHandler.php:33
‪TYPO3\CMS\Extbase\Mvc\Web\AbstractRequestHandler
Definition: AbstractRequestHandler.php:22
‪TYPO3\CMS\Extbase\Mvc\Web
Definition: AbstractRequestHandler.php:2
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler
Definition: FrontendRequestHandler.php:22
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\injectCacheHashEnforcer
‪injectCacheHashEnforcer(\TYPO3\CMS\Extbase\Mvc\Web\CacheHashEnforcer $cacheHashEnforcer)
Definition: FrontendRequestHandler.php:54
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\$configurationManager
‪TYPO3 CMS Extbase Configuration ConfigurationManagerInterface $configurationManager
Definition: FrontendRequestHandler.php:25
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\injectExtensionService
‪injectExtensionService(\TYPO3\CMS\Extbase\Service\ExtensionService $extensionService)
Definition: FrontendRequestHandler.php:46
‪TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler\$extensionService
‪TYPO3 CMS Extbase Service ExtensionService $extensionService
Definition: FrontendRequestHandler.php:29