MediaWiki master
|
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 29 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 123 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 391 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 239 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 360 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 311 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 333 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 523 of file Router.php.
MediaWiki\Rest\Router::setCors | ( | CorsUtils | $cors | ) |
MediaWiki\Rest\Router::setStats | ( | StatsdDataFactoryInterface | $stats | ) |
|
protected |