MediaWiki
master
|
Virtual HTTP service client loosely styled after a Virtual File System. More...
Public Member Functions | |
__construct (MultiHttpClient $http) | |
getMountAndService ($path) | |
Get the prefix and service that a virtual path is serviced by. More... | |
mount ($prefix, VirtualRESTService $instance) | |
Map a prefix to service handler. More... | |
run (array $req) | |
Execute a virtual HTTP(S) request. More... | |
runMulti (array $reqs) | |
Execute a set of virtual HTTP(S) requests concurrently. More... | |
unmount ($prefix) | |
Unmap a prefix to service handler. More... | |
Public Attributes | |
const | VALID_MOUNT_REGEX = '#^/[0-9a-z]+/([0-9a-z]+/)*$#' |
Protected Attributes | |
MultiHttpClient | $http |
VirtualRESTService[] | $instances = [] |
Map of (prefix => VirtualRESTService) More... | |
Virtual HTTP service client loosely styled after a Virtual File System.
Services can be mounted on path prefixes so that virtual HTTP operations against sub-paths will map to those services. Operations can actually be done using HTTP messages over the wire or may simple be emulated locally.
Virtual HTTP request maps are arrays that use the following format:
Definition at line 46 of file VirtualRESTServiceClient.php.
VirtualRESTServiceClient::__construct | ( | MultiHttpClient | $http | ) |
MultiHttpClient | $http |
Definition at line 57 of file VirtualRESTServiceClient.php.
VirtualRESTServiceClient::getMountAndService | ( | $path | ) |
Get the prefix and service that a virtual path is serviced by.
string | $path |
Definition at line 96 of file VirtualRESTServiceClient.php.
References $matches, $path, and as.
Referenced by runMulti().
VirtualRESTServiceClient::mount | ( | $prefix, | |
VirtualRESTService | $instance | ||
) |
Map a prefix to service handler.
string | $prefix | Virtual path |
VirtualRESTService | $instance |
Definition at line 67 of file VirtualRESTServiceClient.php.
VirtualRESTServiceClient::run | ( | array | $req | ) |
Execute a virtual HTTP(S) request.
This method returns a response map of:
array | $req | Virtual HTTP request maps |
Definition at line 136 of file VirtualRESTServiceClient.php.
References runMulti().
VirtualRESTServiceClient::runMulti | ( | array | $reqs | ) |
Execute a set of virtual HTTP(S) requests concurrently.
A map of requests keys to response maps is returned. Each response map has:
array | $reqs | Map of Virtual HTTP request maps |
Exception |
Definition at line 158 of file VirtualRESTServiceClient.php.
References $req, as, getMountAndService(), http, list, and use.
Referenced by run().
VirtualRESTServiceClient::unmount | ( | $prefix | ) |
Unmap a prefix to service handler.
string | $prefix | Virtual path |
Definition at line 81 of file VirtualRESTServiceClient.php.
|
protected |
Definition at line 48 of file VirtualRESTServiceClient.php.
Referenced by __construct().
|
protected |
Map of (prefix => VirtualRESTService)
Definition at line 50 of file VirtualRESTServiceClient.php.
const VirtualRESTServiceClient::VALID_MOUNT_REGEX = '#^/[0-9a-z]+/([0-9a-z]+/)*$#' |
Definition at line 52 of file VirtualRESTServiceClient.php.