call the method to jump to the basket detail page. it will store the calling URL in the session, so
that it becomes possible to jump back to this page from the basket.

@throws RouteNotFoundException
978379
public function JumpToBasketPage()
    {
        $bJumpAsFarAsPossible = false;
        if ('1' === $this->getInputFilterUtil()->getFilteredInput('bJumpAsFarAsPossible')) {
            $bJumpAsFarAsPossible = true;
        }

        // save calling url to session
        $sCallingURL = $this->getCallingUrl();

        MTShopOrderWizardCore::SetCallingURL($sCallingURL);

        $systemPageService = $this->getSystemPageService();
        $checkoutSystemPage = $systemPageService->getSystemPage('checkout');
        if (null === $checkoutSystemPage) {
            throw new RouteNotFoundException("No system page with system name 'checkout' found - unable to redirect to the basket.");
        }
        $iRequestRedirectNodeId = $checkoutSystemPage->fieldCmsTreeId;

        $bNeedToRedirect = true;
        if (false === $bJumpAsFarAsPossible && $this->getActivePageService()->getActivePage()->GetMainTreeId() == $iRequestRedirectNodeId) {
            // we are already on the
            $bNeedToRedirect = false;
        }
        if (true === $bNeedToRedirect) {
            $oNode = new TCMSTreeNode();
            /** @var $oNode TCMSTreeNode */
            if ($oNode->Load($iRequestRedirectNodeId)) {
                $sURL = null;
                if ($bJumpAsFarAsPossible) {
                    $oUser = $this->getExtranetUserProvider()->getActiveUser();
                    $oStep = null;
                    $oBillingAdr = $oUser->GetBillingAddress();
                    if ($oUser->IsLoggedIn() && !is_null($oBillingAdr) && $oBillingAdr->ValidateData(TdbDataExtranetUserAddress::FORM_DATA_NAME_BILLING)) {
                        $oStep = TdbShopOrderStep::GetStep('shipping');
                    } else {
                        $oStep = TdbShopOrderStep::GetStep('user');
                    }
                    if (!is_null($oStep)) {
                        $sURL = $oStep->GetStepURL();
                    }
                }
                if (null === $sURL) {
                    $sURL = $systemPageService->getLinkToSystemPageRelative('checkout');
                }
                $this->getRedirect()->redirect($sURL);
            } else {
                $this->RedirectToCallingPage();
            }
        }
    }
923224
private function buildErrorRoute(): void
    {
        //check if there is a declared route for errors, if no exit with false
        if (($key = \array_search($this->badRoute, \array_column($this->routes->getArrayCopy(), 'name'), true)) === false) {
            $this->route = new NullRoute();

            return;
        }

        //build and store route for errors
        $this->route = $this->routes[$key];
    }
1063141
public function performRoute()
    {
        $this->invokePluginsHook(
            'beforeServiceSelected',
            array($this, $this->getRequest())
        );

        /* Check if we can get the service. */
        try {
            $service = $this->getServiceProvider()->getServiceInstance(
                $this->getRequest()->getController()
            );
        } catch (Exception $e) {
            throw new ResourceNotFoundException(
                'No such service: '.$this->getRequest()->getController()
            );
        }

        /* Loop through each call in the possible batch. */
        $response = array();
        foreach ($this->requests as $request) {
            $callResponse = $this->invokeMethod($service, $request);

            /* Stop here if this isn't a batch. There is only one response. */
            if (false === $this->batch) {
                $response = $callResponse->getResponseObject();
                break;
            }

            /* Omit empty responses from the batch response. */
            if ($callResponse = $callResponse->getResponseObject()) {
                $response[] = $callResponse;
            }
        }

        @header('Content-type: application/json');
        $response = new Response($response);
        return $this->getEncoder()->encode($response);
    }
621234
public function process() {
		$route = $this->findFirstMatchingRoute();
		if( !$route ) {
			// Not found, look for an alternative (with /)
			$route = $this->findFirstMatchingRoute(true);
			if( $route ) {
				// Alternative found, try to redirect to this one
				$r = $this->redirect($route);
				if( $r ) {
					// Redirect
					return $r;
				}
				// Unable to redirect, throw not found
				$route = null;
			}
		}
		return $this->processRoute($route);
	}
1229450
public static void notFound(Router router, Class<? extends NotFoundResponseWriter> notFound) {
		notFound(router, null, notFound);
	}
349617
function run(route, index, path, query, res, next) {
    mm.create(route.action).then(
        function (presenter) {
            var ele = new Element('div');

            function finish() {
                var model = presenter.model;
                res.html = ele.outerHTML;
                res.data = model.store;
                res.routeIndex = index;
                next();
            }

            presenter
                .enter(ele, path, query)
                .then(finish, next);
        },
        next
    ).then(null, next);
}
793132
public function route()
    {
        global $logger;
        try {
            // TODO : Refactor Code :
            // $url    = URLParser::parse();
            // $route  = RouteMapper::getRoute($url['route']);
            // $router = new Router();
            // $router->route($route);
            $urlInterpreter = new UrlInterpreter();
            $command        = $urlInterpreter->getCommand();
            $router         = new Router($command);
            $logger->debug('Routing to : '.$command->getControllerName());
            $router->route();
        } catch (Exception $e) {
            throw new RouteNotFoundException();	
        }
    }
524769
protected function RedirectToCallingPage()
    {
        $aParameters = array();
        $aIncludeParams = TdbShop::GetURLPageStateParameters();
        $oGlobal = TGlobal::instance();
        foreach ($aIncludeParams as $sKeyName) {
            if ($oGlobal->UserDataExists($sKeyName)) {
                $aParameters[$sKeyName] = $oGlobal->GetUserData($sKeyName);
            }
        }
        $sURL = $this->getActivePageService()->getActivePage()->GetRealURLPlain($aParameters);
        $this->getRedirect()->redirect($sURL);
    }
183335
def navigated
      url = get_location
      @params = []

      idx = match(path_to_parts(decode(url.pathname)), decode(url.search))

      if idx
        @routes[idx][:callback].call(@params)
      else
        @page404.call(url.pathname)
      end
    end
454861
public function resolveNotFoundRoute()
    {
        // Try to resolve 404 route. If such route don't
        // exist just redirect to the homepage.
        try {
            if ($notFoundRoute = $this->routes->get('404')) {
                return $notFoundRoute->run();
            }
        } catch (RoutingException $e) {
            if (wp_redirect(home_url())) {
                // WordPress requires to call exit after wp_redirect.
                // We cannot test it, so ignore this single line.
                // @codeCoverageIgnoreStart
                exit();
                // @codeCoverageIgnoreEnd
            }
        }
    }
1366107
protected function getCallingUrl()
    {
        $oGlobal = TGlobal::instance();
        $sCallingURL = $oGlobal->GetUserData('sourceurl');
        if (true === empty($sCallingURL)) {
            //the method will most likely be called on a basket page, in this case, ignore it...
            $activePageService = $this->getActivePageService();
            $oActivePage = $activePageService->getActivePage();
            $checkoutSystemPage = $this->getSystemPageService()->getSystemPage('checkout');
            if (null === $checkoutSystemPage || $checkoutSystemPage->fieldCmsTreeId !== $oActivePage->GetMainTreeId()) {
                $aExcludeParams = array('module_fnc');
                // we may be on a category list or an item page... so ignore those parameters, too
                $aExcludeParams[] = MTShopArticleCatalogCore::URL_CATEGORY_ID;
                $aExcludeParams[] = MTShopArticleCatalogCore::URL_ITEM_ID;
                $aExcludeParams[] = MTShopBasketCore::URL_REQUEST_PARAMETER;

                $sCallingURL = $activePageService->getLinkToActivePageRelative(array(), $aExcludeParams);
            } else {
                //basket, so try to get from session
                if (isset($_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME]) && !empty($_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME])) {
                    $sCallingURL = $_SESSION[MTShopOrderWizardCore::SESSION_PARAM_NAME];
                } else {
                    $portal = $this->getPortalDomainService()->getActivePortal();
                    if (null !== $portal) {
                        $sCallingURL = $this->getPageService()->getLinkToPortalHomePageAbsolute();
                    } else {
                        $sCallingURL = '/';
                    }
                }
            }
        }

        return $sCallingURL;
    }
707485
protected function setAfterSendRoute()
    {
        if ($this->routeAction && ($this->request->getActionName() !== $this->routeAction)) {
            $this->afterSendRouteUrl = array('action' => $this->routeAction);

            $keys  = $this->model->getKeys();
            if (count($keys) == 1) {
                $key = reset($keys);
                if (isset($this->formData[$key])) {
                    $this->afterSendRouteUrl[\MUtil_Model::REQUEST_ID] = $this->formData[$key];
                }
            } else {
                $i = 1;
                foreach ($keys as $key) {
                    if (isset($this->formData[$key])) {
                        $this->afterSendRouteUrl[\MUtil_Model::REQUEST_ID . $i] = $this->formData[$key];
                    }
                    $i++;
                }
            }

            $this->afterSendRouteUrl['controller'] = $this->request->getControllerName();

            $find['action'] = $this->afterSendRouteUrl['action'];
            $find['controller'] = $this->afterSendRouteUrl['controller'];

            if (null == $this->menu->find($find)) {
                $this->afterSendRouteUrl['action'] = 'index';
                $this->resetRoute = true;
            }
        }
    }
886872
function () {
			this.router = UIComponent.getRouterFor(this);
			this.router.attachRoutePatternMatched(this.onRouteMatched, this);
			this._component = Component.getOwnerComponentFor(this.getView());
			// click handler for @link tags in JSdoc fragments
			this.getView().attachBrowserEvent("click", this.onJSDocLinkClick, this);

			this.getView().addEventDelegate({
				onBeforeFirstShow: jQuery.proxy(this._applyViewConfigurations, this)
			});
		}
49920
public function it_throws_circular_redirection_exception_on_redirect_that_does_not_change_url(
        UriInterface $redirectUri,
        RequestInterface $request,
        ResponseInterface $redirectResponse
    ) {
        $redirectResponse->getStatusCode()->willReturn(302);
        $redirectResponse->hasHeader('Location')->willReturn(true);
        $redirectResponse->getHeaderLine('Location')->willReturn('/redirect');

        $next = function () use ($redirectResponse): Promise {
            return new HttpFulfilledPromise($redirectResponse->getWrappedObject());
        };

        $first = function () {
            throw new \Exception('First should never be called');
        };

        $request->getUri()->willReturn($redirectUri);
        $redirectUri->__toString()->willReturn('/redirect');

        $redirectUri->withPath('/redirect')->willReturn($redirectUri);
        $redirectUri->withFragment('')->willReturn($redirectUri);
        $redirectUri->withQuery('')->willReturn($redirectUri);

        $request->withUri($redirectUri)->willReturn($request);
        $redirectUri->__toString()->willReturn('/redirect');
        $request->getMethod()->willReturn('GET');

        $promise = $this->handleRequest($request, $next, $first);
        $promise->shouldReturnAnInstanceOf(HttpRejectedPromise::class);
        $promise->shouldThrow(CircularRedirectionException::class)->duringWait();
    }
396918
public function processRoute($route) {
		if( !$route ) {
			throw new NotFoundException('No route matches the current request '.$this);
		}
		$this->setRoute($route);
		return $this->route->run($this);
	}
1084301
protected function handleDispatcherResponse($routeInfo, $httpMethod, $uri)
    {
        if ($routeInfo[0] == \FastRoute\Dispatcher::NOT_FOUND) {
            throw new Exception("Not found handler: $uri", 404);
        }
        if ($routeInfo[0] == \FastRoute\Dispatcher::METHOD_NOT_ALLOWED) {
            $allowed = (array)$routeInfo[1];
            throw new Exception("Method Not Allowed: $uri, allowed: " . implode(',', $allowed), 405);
        }

        // \FastRoute\Dispatcher::FOUND
        $this->handleFoundRoute($routeInfo);
    }
1081637
@Override
    public void onModuleLoad() {
        //start from the requested URL
        jcrService.getRequestedURI(new BaseCallback<String>() {

            @SuppressWarnings( "synthetic-access" )
            @Override
            public void onSuccess( String result ) {
                //parse requested url to determine navigation
                jcrURL.parse(result);
  
                //before navigate to the requested URL we need to
                //check is this user already logged in or not yet.
                getCredentials();
            }
        });
    }