protected function handleRouting(HttpRequest $request)
    {
        $this->router = $this->serviceManager->get('Router');
        $this->router->warmUp($this->getCacheDir());

        try {
            // Lets load up our router and match the appropriate route
            $parameters = $this->router->matchRequest($request);
            if (!empty($parameters)) {
                if (null !== $this->logger) {
                    $this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->router->parametersToString($parameters)));
                }
            }
        } catch (ResourceNotFoundException $e) {
            $routeUri = $this->router->generate('Framework_404');
            $parameters = $this->router->matchRequest($request::create($routeUri));
        } catch (\Exception $e) {
            throw $e;
        }

        $parameters['_route_params'] = $parameters;

        return $parameters;
    }