‪TYPO3CMS  10.4
TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler Class Reference
Inheritance diagram for TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler:

Public Member Functions

 __construct (RedirectService $redirectService)
 
ResponseInterface process (ServerRequestInterface $request, RequestHandlerInterface $handler)
 

Protected Member Functions

ResponseInterface buildRedirectResponse (UriInterface $uri, array $redirectRecord)
 
 incrementHitCount (array $redirectRecord)
 
 redirectUriWillRedirectToCurrentUri (ServerRequestInterface $request, UriInterface $redirectUri)
 
 sanitizeUriForComparison (UriInterface $uri, bool $relativeCheck)
 

Protected Attributes

RedirectService $redirectService
 

Detailed Description

Hooks into the frontend request, and checks if a redirect should apply, If so, a redirect response is triggered.

Definition at line 40 of file RedirectHandler.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::__construct ( RedirectService  $redirectService)

Member Function Documentation

◆ buildRedirectResponse()

ResponseInterface TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::buildRedirectResponse ( UriInterface  $uri,
array  $redirectRecord 
)
protected

Creates a PSR-7 compatible Response object

Parameters
UriInterface$uri
array$redirectRecord
Returns
‪ResponseInterface

Definition at line 111 of file RedirectHandler.php.

Referenced by TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler\process().

◆ incrementHitCount()

TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::incrementHitCount ( array  $redirectRecord)
protected

Updates the sys_record's hit counter by one

Parameters
array$redirectRecord

Definition at line 125 of file RedirectHandler.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler\process().

◆ process()

ResponseInterface TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::process ( ServerRequestInterface  $request,
RequestHandlerInterface  $handler 
)

First hook within the Frontend Request handling

Parameters
ServerRequestInterface$request
RequestHandlerInterface$handler
Returns
‪ResponseInterface

Definition at line 60 of file RedirectHandler.php.

References $GLOBALS, TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler\buildRedirectResponse(), TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler\incrementHitCount(), and TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler\redirectUriWillRedirectToCurrentUri().

◆ redirectUriWillRedirectToCurrentUri()

TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::redirectUriWillRedirectToCurrentUri ( ServerRequestInterface  $request,
UriInterface  $redirectUri 
)
protected

Checks if redirect uri matches current request uri.

Definition at line 146 of file RedirectHandler.php.

References TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler\sanitizeUriForComparison().

Referenced by TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler\process().

◆ sanitizeUriForComparison()

TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::sanitizeUriForComparison ( UriInterface  $uri,
bool  $relativeCheck 
)
protected

Strip down uri to be suitable to make valid comparison in 'redirectUriWillRedirectToCurrentUri()' if uri is pointing to itself and redirect should be processed.

Definition at line 159 of file RedirectHandler.php.

References TYPO3\CMS\Core\Utility\HttpUtility\buildQueryString().

Referenced by TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler\redirectUriWillRedirectToCurrentUri().

Member Data Documentation

◆ $redirectService

RedirectService TYPO3\CMS\Redirects\Http\Middleware\RedirectHandler::$redirectService
protected