MediaWiki  1.32.5
PageDataRequestHandler Class Reference

Request handler implementing a data interface for mediawiki pages. More...

Public Member Functions

 canHandleRequest ( $subPage, WebRequest $request)
 Checks whether the request is complete, i.e. More...
 
 handleRequest ( $subPage, WebRequest $request, OutputPage $output)
 Main method for handling requests. More...
 
 httpContentNegotiation (WebRequest $request, OutputPage $output, Title $title, $revision=0)
 Applies HTTP content negotiation. More...
 

Private Member Functions

 getDocUrl (Title $title, $format='', $revision=0)
 Returns a url representing the given title. More...
 

Detailed Description

Request handler implementing a data interface for mediawiki pages.

Author
Daniel Kinzler
Amir Sarabadanai

Definition at line 30 of file PageDataRequestHandler.php.

Member Function Documentation

◆ canHandleRequest()

PageDataRequestHandler::canHandleRequest (   $subPage,
WebRequest  $request 
)

Checks whether the request is complete, i.e.

whether it contains all information needed to reply with page data.

This does not check whether the request is valid and will actually produce a successful response.

Parameters
string | null$subPage
WebRequest$request
Returns
bool
Exceptions
HttpError

Definition at line 45 of file PageDataRequestHandler.php.

References $request.

Referenced by handleRequest().

◆ getDocUrl()

PageDataRequestHandler::getDocUrl ( Title  $title,
  $format = '',
  $revision = 0 
)
private

Returns a url representing the given title.

Parameters
Title$title
string | null$formatThe (normalized) format name, or ''
int$revision
Returns
string

Definition at line 172 of file PageDataRequestHandler.php.

References $params, and $title.

Referenced by httpContentNegotiation().

◆ handleRequest()

PageDataRequestHandler::handleRequest (   $subPage,
WebRequest  $request,
OutputPage  $output 
)

Main method for handling requests.

Parameters
string$subPage
WebRequest$requestThe request parameters. Known parameters are:
  • title: the page title
  • format: the format
  • oldid|revision: the revision ID
OutputPage$output
Note
Instead of an output page, a WebResponse could be sufficient, but redirect logic is currently implemented in OutputPage.
Exceptions
HttpError

Definition at line 80 of file PageDataRequestHandler.php.

References $output, $request, $title, canHandleRequest(), httpContentNegotiation(), Title\newFromTextThrow(), and wfMessage().

◆ httpContentNegotiation()

PageDataRequestHandler::httpContentNegotiation ( WebRequest  $request,
OutputPage  $output,
Title  $title,
  $revision = 0 
)

Applies HTTP content negotiation.

If the negotiation is successful, this method will set the appropriate redirect in the OutputPage object and return. Otherwise, an HttpError is thrown.

Parameters
WebRequest$request
OutputPage$output
Title$title
int$revisionThe desired revision
Exceptions
HttpError

Definition at line 126 of file PageDataRequestHandler.php.

References $output, $parser, $request, $title, getDocUrl(), ContentHandler\getForTitle(), and wfMessage().

Referenced by handleRequest().


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