MediaWiki 1.42.0
|
The REST router is responsible for gathering handler configuration, matching an input path and HTTP method against the defined routes, and constructing and executing the relevant handler for a request. More...
Public Member Functions | |
__construct ( $routeFiles, $extraRoutes, ServiceOptions $options, BagOStuff $cacheBag, ResponseFactory $responseFactory, BasicAuthorizerInterface $basicAuth, Authority $authority, ObjectFactory $objectFactory, Validator $restValidator, ErrorReporter $errorReporter, HookContainer $hookContainer, Session $session) | |
execute (RequestInterface $request) | |
Find the handler for a request and execute it. | |
getAllRoutes () | |
Get an iterator for all defined routes, including loading the routes from the JSON files. | |
getPrivateRouteUrl (string $route, array $pathParams=[], array $queryParams=[]) | |
Returns a full private URL for the given route. | |
getRoutePath (string $route, array $pathParams=[], array $queryParams=[]) | |
Returns the path part of the route URL for the given route, including the root path. | |
getRouteUrl (string $route, array $pathParams=[], array $queryParams=[]) | |
Returns a full URL for the given route. | |
instantiateHandlerObject (array $spec) | |
Creates a handler from the given spec, but does not initialize it. | |
setCors (CorsUtils $cors) | |
setStats (StatsdDataFactoryInterface $stats) | |
Protected Member Functions | |
substPathParams (string $route, array $pathParams) | |
The REST router is responsible for gathering handler configuration, matching an input path and HTTP method against the defined routes, and constructing and executing the relevant handler for a request.
Definition at line 28 of file Router.php.
MediaWiki\Rest\Router::__construct | ( | $routeFiles, | |
$extraRoutes, | |||
ServiceOptions | $options, | ||
BagOStuff | $cacheBag, | ||
ResponseFactory | $responseFactory, | ||
BasicAuthorizerInterface | $basicAuth, | ||
Authority | $authority, | ||
ObjectFactory | $objectFactory, | ||
Validator | $restValidator, | ||
ErrorReporter | $errorReporter, | ||
HookContainer | $hookContainer, | ||
Session | $session ) |
string[] | $routeFiles | List of names of JSON files containing routes |
array | $extraRoutes | Extension route array |
ServiceOptions | $options | |
BagOStuff | $cacheBag | A cache in which to store the matcher trees |
ResponseFactory | $responseFactory | |
BasicAuthorizerInterface | $basicAuth | |
Authority | $authority | |
ObjectFactory | $objectFactory | |
Validator | $restValidator | |
ErrorReporter | $errorReporter | |
HookContainer | $hookContainer | |
Session | $session |
Definition at line 122 of file Router.php.
References MediaWiki\Config\ServiceOptions\assertRequiredOptions(), MediaWiki\MainConfigNames\CanonicalServer, MediaWiki\Config\ServiceOptions\get(), MediaWiki\MainConfigNames\InternalServer, and MediaWiki\MainConfigNames\RestPath.
MediaWiki\Rest\Router::execute | ( | RequestInterface | $request | ) |
Find the handler for a request and execute it.
RequestInterface | $request |
Definition at line 390 of file Router.php.
References $path, MediaWiki\Rest\RequestInterface\getMethod(), MediaWiki\Rest\RequestInterface\getUri(), and MediaWiki\Rest\RequestInterface\setPathParams().
MediaWiki\Rest\Router::getAllRoutes | ( | ) |
Get an iterator for all defined routes, including loading the routes from the JSON files.
Definition at line 238 of file Router.php.
MediaWiki\Rest\Router::getPrivateRouteUrl | ( | string | $route, |
array | $pathParams = [], | ||
array | $queryParams = [] ) |
Returns a full private URL for the given route.
Private URLs are for use within the local subnet, they may use host names or ports or paths that are not publicly accessible. Intended for use in redirects and when including links to endpoints in output.
string | $route | |
array | $pathParams | |
array | $queryParams |
Definition at line 359 of file Router.php.
MediaWiki\Rest\Router::getRoutePath | ( | string | $route, |
array | $pathParams = [], | ||
array | $queryParams = [] ) |
Returns the path part of the route URL for the given route, including the root path.
Intended for use in relative redirects.
string | $route | |
array | $pathParams | |
array | $queryParams |
Definition at line 310 of file Router.php.
MediaWiki\Rest\Router::getRouteUrl | ( | string | $route, |
array | $pathParams = [], | ||
array | $queryParams = [] ) |
Returns a full URL for the given route.
Intended for use in redirects and when including links to endpoints in output.
string | $route | |
array | $pathParams | |
array | $queryParams |
Definition at line 332 of file Router.php.
MediaWiki\Rest\Router::instantiateHandlerObject | ( | array | $spec | ) |
Creates a handler from the given spec, but does not initialize it.
array | $spec |
Definition at line 519 of file Router.php.
MediaWiki\Rest\Router::setCors | ( | CorsUtils | $cors | ) |
MediaWiki\Rest\Router::setStats | ( | StatsdDataFactoryInterface | $stats | ) |
|
protected |