What to do if the entry point is not recognized.

@param string $unrecognizedPath

@return Response
6807
public function unrecognizedCall($unrecognizedPath = '')
    {
        $this->start();

        if ($unrecognizedPath === '') {
            $message = t('Resource not specified');
        } else {
            $message = t(/*i18n: %1$s is a path, %2$s is an HTTP method*/'Unknown resource %1$s for %2$s method', $unrecognizedPath, $this->request->getMethod());
        }
        $result = $this->buildErrorResponse(
            $message,
            Response::HTTP_NOT_FOUND
        );

        return $this->finish($result);
    }
1035665
public function lookup($path)
	{
		if($match = $this->_getRouteMatch($path,$this->_routes))
			return $match;

		if($match = $this->_getRouteMatch($path,$this->_customRoutes))
			return $match;

		throw new LookupException("No route matches path '$path'");
	}
1186269
public function redirect($path, $status = 301)
    {
        if (!$this->asWidget) {
            /** @var ResponseInterface $response */
            $response = (new ResponseInjector)->build();
            if (!$response) {
                throw new Exception('Component `response` not configured');
            }

            $response = $response->withStatus($status);
            $response = $response->getHeaderLine('Location: '.$path);

            return $response;
        }

        return false;
    }
880663
public function startAuthentication(Request $request, Response $response)
    {
        if (isset($this->options['routeValues'])) {
            $routeValues = $this->options['routeValues'];
            if (!is_array($routeValues)) {
                throw new MissingConfigurationException(sprintf('The configuration for the WebRedirect authentication entry point is incorrect. "routeValues" must be an array, got "%s".', gettype($routeValues)), 1345040415);
            }
            $actionRequest = new ActionRequest($request);
            $this->uriBuilder->setRequest($actionRequest);

            $actionName = $this->extractRouteValue($routeValues, '@action');
            $controllerName = $this->extractRouteValue($routeValues, '@controller');
            $packageKey = $this->extractRouteValue($routeValues, '@package');
            $subPackageKey = $this->extractRouteValue($routeValues, '@subpackage');
            $uri = $this->uriBuilder->setCreateAbsoluteUri(true)->uriFor($actionName, $routeValues, $controllerName, $packageKey, $subPackageKey);
        } elseif (isset($this->options['uri'])) {
            $uri = strpos($this->options['uri'], '://') !== false ? $this->options['uri'] : $request->getBaseUri() . $this->options['uri'];
        } else {
            throw new MissingConfigurationException('The configuration for the WebRedirect authentication entry point is incorrect or missing. You need to specify either the target "uri" or "routeValues".', 1237282583);
        }

        $response->setContent(sprintf('<html><head><meta http-equiv="refresh" content="0;url=%s"/></head></html>', htmlentities($uri, ENT_QUOTES, 'utf-8')));
        $response->setStatus(303);
        $response->setHeader('Location', $uri);
    }
1202672
function path($name, $null_on_failure = false) {
		if ( ! isset($this->registeredpaths[$name])) {
			if ($null_on_failure) {
				return null;
			}
			else { // panic
				throw new Panic("There is no path registered for $name.");
			}
		}
		else { //
			return $this->registeredpaths[$name];
		}
	}
1227891
protected function httpPost(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface
    {
        return $this->httpPostRaw($path, $this->createRequestBody($parameters), $requestHeaders);
    }
53043
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        try {
            $route = $this->matchRoute($request);
        } catch (RouteException $e) {
            throw new RouterException("Invalid route definition", $e->getCode(), $e);
        }

        if (empty($route)) {
            throw new RouteNotFoundException($request->getUri());
        }

        return $this->container->get(ScopeInterface::class)->runScope(
            [RouteInterface::class => $route],
            function () use ($route, $request) {
                return $route->handle($request);
            }
        );
    }
473360
protected function resolveUnsecuredResource($relativePath)
    {
        // Check if the path requested is public-only, but we have no public folder
        $publicOnly = $this->inferPublicResourceRequired($relativePath);
        if ($publicOnly) {
            trigger_error('Requesting a public resource without a public folder has no effect', E_USER_WARNING);
        }

        // Resolve path to base
        $absolutePath = Path::join(Director::baseFolder(), $relativePath);
        $exists = file_exists($absolutePath);

        // Rewrite vendor/ to _resources/ folder
        if (stripos($relativePath, ManifestFileFinder::VENDOR_DIR . DIRECTORY_SEPARATOR) === 0) {
            $relativePath = Path::join(
                RESOURCES_DIR,
                substr($relativePath, strlen(ManifestFileFinder::VENDOR_DIR))
            );
        }
        return [$exists, $absolutePath, $relativePath];
    }
553987
public function assertAtPath($path)
    {
        $this->getSession()->visit($this->locatePath($path));

        // If available, add extra validation that this is a 200 response.
        try {
            $this->getSession()->getStatusCode();
            $this->assertHttpResponse('200');
        } catch (UnsupportedDriverActionException $e) {
            // Simply continue on, as this driver doesn't support HTTP response codes.
        }
    }
434780
public function routePage($path)
    {
        $url = URL::findByLocation($path);

        if ($url) {
            $page = $url->getPage();

            if (!$page || $page->isDeleted()) {
                // The url is in use but doesn't have a page.
                // The page must have been deleted.
                throw new GoneHttpException();
            }

            if (Editor::isDisabled() && !$page->isVisible()) {
                throw new NotFoundHttpException();
            }

            if (!$page->url()->matches($path)) {
                return redirect((string) $page->url(), 301);
            }

            $this->setActivePage($page);

            return;
        }

        throw new NotFoundHttpException();
    }
120526
public function createFallbackPathEntry(string $path)
    {
        $entryIdentifier = md5($path);
        if (!isset($this->fallbackClassPaths[$entryIdentifier])) {
            $this->fallbackClassPaths[$entryIdentifier] = [
                'path' => $path,
                'mappingType' => self::MAPPING_TYPE_PSR4
            ];
        }
    }
759447
protected function validatePath(string $path): void
    {
        if (empty($path)) {
            $this->fail(new InvalidArgumentException("Path is not specified"));
        }

        if (!is_string($path)) {
            $this->fail(new InvalidArgumentException("Path is not a string"));
        }
    }
744212
public function post($path=null,$parameters=null)
    {
        if($parameters){
            foreach($parameters as $key=>$parameter)
                $this->addFormParameter($key,$parameter);
        }
        return $this->startRequest('POST', $path);
    }
984063
public function moveTo($targetPath)
    {
        if ($this->moved) {
            throw new RuntimeException('Uploaded file already moved');
        }

        if (! is_writable(dirname($targetPath))) {
            throw new InvalidArgumentException('Upload target path is not writable');
        }

        if (! @rename($this->file, $targetPath)) {
            throw new RuntimeException(
                sprintf('Error moving uploaded file %1s to %2s', $this->name, $targetPath)
            );
        }

        $this->moved = true;
    }
131362
public function setPath($path)
        {
            if ($this->validatePath($path) === false) {
                throw new Exception("Path \"$path\" is not a valid HTTP path");
            }

            $oldPath     = $this->_path;
            $this->_path = $path;

            return $oldPath;
        }
482555
public function launch(Request $request, Response $response)
    {
        if (count($this->routes) === 0) {
            throw new \RuntimeException("No routes defined");
        }

        $this->uri = $request->httpRequest->getPath();

        if ($this->uri = null) {
            $this->uri = "/";
        }

        $request->on('end', function () use (&$request, &$response) {
            $this->matchRoutes($request, $response);  
        });

        $request->on('error', function ($error) use (&$request, &$response) {
            $this->emit('error', [$request, $response, $error]);
        });

        $request->parseData();
    }
774172
public static function fromUnWritableFile($path)
    {
        if (! file_exists(dirname($path))) {
            return new self(
                sprintf('Invalid path provided, the path "%s" does not seem to have a parent directory', $path)
            );
        }

        if (is_dir($path)) {
            return new self(
                sprintf('The provided path "%s" is a directory, and it cannot be written as a file', $path)
            );
        }

        return new self(sprintf('The provided path "%s" is invalid', $path));
    }