use LoggerAwareTrait;
/**
+ * @var RedirectService
+ */
+ protected $redirectService;
+
+ public function __construct(RedirectService $redirectService)
+ {
+ $this->redirectService = $redirectService;
+ }
+
+ /**
* First hook within the Frontend Request handling
*
* @param ServerRequestInterface $request
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
- $redirectService = GeneralUtility::makeInstance(RedirectService::class);
$port = $request->getUri()->getPort();
- $matchedRedirect = $redirectService->matchRedirect(
+ $matchedRedirect = $this->redirectService->matchRedirect(
$request->getUri()->getHost() . ($port ? ':' . $port : ''),
$request->getUri()->getPath(),
$request->getUri()->getQuery() ?? ''
// If the matched redirect is found, resolve it, and check further
if (is_array($matchedRedirect)) {
- $url = $redirectService->getTargetUrl($matchedRedirect, $request->getQueryParams(), $request->getAttribute('site', null));
+ $url = $this->redirectService->getTargetUrl($matchedRedirect, $request->getQueryParams(), $request->getAttribute('site', null));
if ($url instanceof UriInterface) {
$this->logger->debug('Redirecting', ['record' => $matchedRedirect, 'uri' => $url]);
$response = $this->buildRedirectResponse($url, $matchedRedirect);