public function filter()
    {
        $requestUrl = $this->application->request->getQuery('url', '/');
        $requestMethod = $this->application->request->getMethod();
        $event = new Route([
            'router' => $this,
            'application' => $this->application,
            'request' => $this->application->request
        ]);
        $this->_application->getEventManager()
            ->trigger(Route::BEFORE_ROUTE, $this, $event);
        $options = $this->getService()->match($requestUrl, $requestMethod);
        if ($options == false) {
            throw new RouterException(
                "No route was found for the given request URL."
            );
        }
        // Route match, add the extension
        $cfg = $this->application->getContainer()->get('configuration');


        $routerInfo = new RouteInfo($options);
        $routerInfo->setConfiguration($cfg)
            ->setTarget($options['target']);

        $extension = $this->application->getRequest()
            ->getQuery('extension');

        if (strlen($extension) < 1) {
            $extension = $cfg->get('router.extension', 'html');
        }
        $routerInfo->extension = $extension;

        $event->routeInfo = $routerInfo;
        $this->_application->getEventManager()
            ->trigger(Route::AFTER_ROUTE, $this, $event);
        return $event->routeInfo;
    }