protected function locateMethod()
    {

        # When no request string, use default route.
        if ($this->request_uri === '')
        {
            $callback = $this->route_rules['/'];
            $this->located_controller = $callback['controller'];
            $this->located_method = $callback['method'];
            return TRUE;
        }

        # Finding matched route.
        foreach ($this->route_rules as $rule => $callback)
        {
            preg_match('#^' . $rule . '#', $this->request_uri, $matches);
            if ($matches)
            {
                $controller = $callback['controller'];
                $method = $callback['method'];
                $index = 0;

                # Locating controller class.
                if (strpos($controller, '@') !== FALSE)
                {
                    $at = substr($controller, 1);
                    if ($at == 0 || !isset($matches[$at]))
                    {
                        throw new Exception('@' . $at . ' not found in regex.');
                    }

                    $controller = $matches[$at];
                    $index = ++$at;
                }

                # Locating controller method name.
                if (strpos($method, '@') !== FALSE)
                {
                    $at = substr($method, 1);
                    if ($at == 0 || !isset($matches[$at]))
                    {
                        throw new Exception('@' . $at . ' not found in regex.');
                    }
                    $method = $matches[$at];
                    $index = ++$at;
                }

                # Setting located controller class,method and remaining part
                # which are going to be method parameter to this class property.
                $this->located_controller = $controller;
                $this->located_method = $method;
                $this->remaining_uri = array_slice(explode('/', $this->request_uri), $index);
                break;
            }
        }
    }