MediaWiki  1.28.1
ParsoidVirtualRESTService Class Reference

Virtual HTTP service client for Parsoid. More...

Inheritance diagram for ParsoidVirtualRESTService:
Collaboration diagram for ParsoidVirtualRESTService:

Public Member Functions

 __construct (array $params)
 Example Parsoid v3 requests: GET /local/v3/page/html/$title/{$revision}. More...
 
 onParsoid1Request (array $req, Closure $idGeneratorFunc)
 Remap a Parsoid v1 request to a Parsoid v3 request. More...
 
 onRequests (array $reqs, Closure $idGeneratorFunc)
 
- Public Member Functions inherited from VirtualRESTService
 __construct (array $params)
 
 getName ()
 Return the name of this service, in a form suitable for error reporting or debugging. More...
 
 onRequests (array $reqs, Closure $idGeneratorFunc)
 Prepare virtual HTTP(S) requests (for this service) for execution. More...
 
 onResponses (array $reqs, Closure $idGeneratorFunc)
 Mangle or replace virtual HTTP(S) requests which have been responded to. More...
 

Additional Inherited Members

- Protected Attributes inherited from VirtualRESTService
array $params = []
 Key/value map. More...
 

Detailed Description

Virtual HTTP service client for Parsoid.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html Virtual REST service for Parsoid

Since
1.25

Definition at line 25 of file ParsoidVirtualRESTService.php.

Constructor & Destructor Documentation

ParsoidVirtualRESTService::__construct ( array  $params)

Example Parsoid v3 requests: GET /local/v3/page/html/$title/{$revision}.

  • $revision is optional POST /local/v3/transform/html/to/wikitext/{$title}{/$revision}
  • body: array( 'html' => ... )
  • $title and $revision are optional POST /local/v3/transform/wikitext/to/html/{$title}{/$revision}
  • body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'body_only' => true/false )
  • $title is optional
  • $revision is optional

There are also deprecated "v1" requests; see onParsoid1Request for details.

Parameters
array$paramsKey/value map
  • url : Parsoid server URL
  • domain : Wiki domain to use
  • timeout : Parsoid timeout (optional)
  • forwardCookies : Cookies to forward to Parsoid, or false. (optional)
  • HTTPProxy : Parsoid HTTP proxy (optional)
  • restbaseCompat : whether to parse URL as if they were meant for RESTBase boolean (optional)

Definition at line 49 of file ParsoidVirtualRESTService.php.

Member Function Documentation

ParsoidVirtualRESTService::onParsoid1Request ( array  $req,
Closure  $idGeneratorFunc 
)

Remap a Parsoid v1 request to a Parsoid v3 request.

Example Parsoid v1 requests: GET /local/v1/page/$title/html/$oldid

  • $oldid is optional POST /local/v1/transform/html/to/wikitext/$title/$oldid
  • body: array( 'html' => ... )
  • $title and $oldid are optional POST /local/v1/transform/wikitext/to/html/$title
  • body: array( 'wikitext' => ... ) or array( 'wikitext' => ..., 'body' => true/false )
  • $title is optional

NOTE: the POST APIs aren't "real" Parsoid v1 APIs, they are just what Visual Editor "pretends" the V1 API is like. A previous version of ParsoidVirtualRESTService translated these to the "real" Parsoid v1 API. We now translate these to the "real" Parsoid v3 API.

Definition at line 152 of file ParsoidVirtualRESTService.php.

References $req, $title, and list.

Referenced by onRequests().

ParsoidVirtualRESTService::onRequests ( array  $reqs,
Closure  $idGeneratorFunc 
)

Definition at line 81 of file ParsoidVirtualRESTService.php.

References $req, as, list, and onParsoid1Request().


The documentation for this class was generated from the following file: