MediaWiki REL1_35
|
Virtual HTTP service instance that can be mounted on to a VirtualRESTService. More...
Public Member Functions | |
__construct (array $params) | |
getName () | |
Return the name of this service, in a form suitable for error reporting or debugging. | |
onRequests (array $reqs, Closure $idGeneratorFunc) | |
Prepare virtual HTTP(S) requests (for this service) for execution. | |
onResponses (array $reqs, Closure $idGeneratorFunc) | |
Mangle or replace virtual HTTP(S) requests which have been responded to. | |
Protected Attributes | |
array | $params = [] |
Key/value map. | |
Virtual HTTP service instance that can be mounted on to a VirtualRESTService.
Sub-classes manage the logic of either:
Authentication information can be cached in instances of the class for performance. Such information should also be cached locally on the server and auth requests should have reasonable timeouts.
Definition at line 36 of file VirtualRESTService.php.
VirtualRESTService::__construct | ( | array | $params | ) |
array | $params | Key/value map |
Reimplemented in ParsoidVirtualRESTService, RestbaseVirtualRESTService, and SwiftVirtualRESTService.
Definition at line 43 of file VirtualRESTService.php.
References $params.
VirtualRESTService::getName | ( | ) |
Return the name of this service, in a form suitable for error reporting or debugging.
Definition at line 53 of file VirtualRESTService.php.
VirtualRESTService::onRequests | ( | array | $reqs, |
Closure | $idGeneratorFunc | ||
) |
Prepare virtual HTTP(S) requests (for this service) for execution.
This method should mangle any of the $reqs entry fields as needed:
The incoming URL parameter will be relative to the service mount point.
This method can also remove some of the requests as well as add new ones (using $idGenerator to set each of the entries' array keys). For any existing or added request, the 'response' array can be filled in, which will prevent the client from executing it. If an original request is removed, at some point it must be added back (with the same key) in onRequests() or onResponses(); it's reponse may be filled in as with other requests.
array[] | $reqs | Map of Virtual HTTP request arrays |
Closure | $idGeneratorFunc | Method to generate unique keys for new requests |
Reimplemented in ParsoidVirtualRESTService, SwiftVirtualRESTService, and RestbaseVirtualRESTService.
Definition at line 79 of file VirtualRESTService.php.
VirtualRESTService::onResponses | ( | array | $reqs, |
Closure | $idGeneratorFunc | ||
) |
Mangle or replace virtual HTTP(S) requests which have been responded to.
This method may mangle any of the $reqs entry 'response' fields as needed:
This method can also remove some of the requests as well as add new ones (using $idGenerator to set each of the entries' array keys). For any existing or added request, the 'response' array can be filled in, which will prevent the client from executing it. If an original request is removed, at some point it must be added back (with the same key) in onRequests() or onResponses(); it's reponse may be filled in as with other requests. All requests added to $reqs will be passed through onRequests() to handle any munging required as normal.
The incoming URL parameter will be relative to the service mount point.
array | $reqs | Map of Virtual HTTP request arrays with 'response' set |
Closure | $idGeneratorFunc | Method to generate unique keys for new requests |
Reimplemented in SwiftVirtualRESTService.
Definition at line 114 of file VirtualRESTService.php.
|
protected |
Key/value map.
Definition at line 38 of file VirtualRESTService.php.
Referenced by SwiftVirtualRESTService\__construct(), and __construct().