Request handler implementing a linked data interface for Wikibase entities.
More...
|
| | __construct (EntityDataUriManager $uriManager, HTMLCacheUpdater $htmlCacheUpdater, EntityIdParser $entityIdParser, EntityRevisionLookup $entityRevisionLookup, EntityRedirectLookup $entityRedirectLookup, EntityDataSerializationService $serializationService, EntityDataFormatProvider $entityDataFormatProvider, LoggerInterface $logger, array $entityTypesWithoutRdfOutput, $defaultFormat, $maxAge, $frameOptionsHeader, SubEntityTypesMapper $subEntityTypesMap) |
| | canHandleRequest ( $doc, WebRequest $request) |
| | Checks whether the request is complete, i.e.
|
| | handleRequest ( $doc, WebRequest $request, OutputPage $output) |
| | Main method for handling requests.
|
| | getCanonicalFormat ( $format) |
| | Returns the canonical format name for the given format.
|
| | purgeWebCache (EntityId $id, int $revision) |
| | Purges the entity data identified by the doc parameter from any HTTP caches.
|
| | httpContentNegotiation (WebRequest $request, OutputPage $output, EntityId $id, $revision=0) |
| | Applies HTTP content negotiation.
|
| | outputData (WebRequest $request, EntityId $requestId, int $requestRevision, WebResponse $response, string $data, string $contentType, string $lastModified) |
| | Output the entity data and set the appropriate HTTP response headers.
|
Request handler implementing a linked data interface for Wikibase entities.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
-
Thomas Pellissier Tanon
-
Anja Jentzsch < anja..nosp@m.jent.nosp@m.zsch@.nosp@m.wiki.nosp@m.media.nosp@m..de >
◆ __construct()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::__construct |
( |
EntityDataUriManager | $uriManager, |
|
|
HTMLCacheUpdater | $htmlCacheUpdater, |
|
|
EntityIdParser | $entityIdParser, |
|
|
EntityRevisionLookup | $entityRevisionLookup, |
|
|
EntityRedirectLookup | $entityRedirectLookup, |
|
|
EntityDataSerializationService | $serializationService, |
|
|
EntityDataFormatProvider | $entityDataFormatProvider, |
|
|
LoggerInterface | $logger, |
|
|
array | $entityTypesWithoutRdfOutput, |
|
|
| $defaultFormat, |
|
|
| $maxAge, |
|
|
| $frameOptionsHeader, |
|
|
SubEntityTypesMapper | $subEntityTypesMap ) |
- Parameters
-
| EntityDataUriManager | $uriManager | |
| HTMLCacheUpdater | $htmlCacheUpdater | |
| EntityIdParser | $entityIdParser | |
| EntityRevisionLookup | $entityRevisionLookup | |
| EntityRedirectLookup | $entityRedirectLookup | |
| EntityDataSerializationService | $serializationService | |
| EntityDataFormatProvider | $entityDataFormatProvider | |
| LoggerInterface | $logger | |
| string[] | $entityTypesWithoutRdfOutput | |
| string | $defaultFormat | The format as a file extension or MIME type. |
| int | $maxAge | number of seconds to cache entity data |
| string | null | $frameOptionsHeader | for X-Frame-Options |
| SubEntityTypesMapper | $subEntityTypesMap | |
◆ canHandleRequest()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::canHandleRequest |
( |
| $doc, |
|
|
WebRequest | $request ) |
Checks whether the request is complete, i.e.
whether it contains all information needed to reply with entity data.
This does not check whether the request is valid and will actually produce a successful response.
- Parameters
-
| string | null | $doc | Document name, e.g. Q5 or Q5.json or Q5:33.xml |
| WebRequest | $request | |
- Returns
- bool
◆ getCanonicalFormat()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::getCanonicalFormat |
( |
| $format | ) |
|
Returns the canonical format name for the given format.
- Parameters
-
- Returns
- string
- Exceptions
-
| HttpError | code 415 if the format is not supported. |
◆ getEntityRevision()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::getEntityRevision |
( |
EntityId | $id, |
|
|
| $revision, |
|
|
| $allowRedirects = false ) |
|
private |
Loads the requested Entity.
Redirects are resolved if no specific revision is requested or they are explicitly allowed by $allowRedirects.
- Parameters
-
| EntityId | $id | |
| int | $revision | The revision ID (use 0 for the current revision). |
| bool | $allowRedirects | Can we fetch redirects when revision is set? |
- Returns
- array list( EntityRevision, RedirectRevision|null )
- Exceptions
-
◆ getIncomingRedirects()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::getIncomingRedirects |
( |
EntityId | $id | ) |
|
|
private |
Loads incoming redirects referring to the given entity ID.
- Parameters
-
- Returns
- EntityId[]
- Exceptions
-
◆ handleRequest()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::handleRequest |
( |
| $doc, |
|
|
WebRequest | $request, |
|
|
OutputPage | $output ) |
Main method for handling requests.
- Parameters
-
| null | string | $doc | Document name, e.g. Q5 or Q5.json or Q5:33.xml |
| WebRequest | $request | The request parameters. Known parameters are:
- id: the entity ID
- format: the format
- oldid|revision: the revision ID
- action=purge: to purge cached data from (web) caches
|
| OutputPage | $output | |
- Note
- Instead of an output page, a WebResponse could be sufficient, but redirect logic is currently implemented in OutputPage.
- Exceptions
-
◆ httpContentNegotiation()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::httpContentNegotiation |
( |
WebRequest | $request, |
|
|
OutputPage | $output, |
|
|
EntityId | $id, |
|
|
| $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 | |
| EntityId | $id | The ID of the entity to show |
| int | $revision | The desired revision |
- Exceptions
-
◆ outputData()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::outputData |
( |
WebRequest | $request, |
|
|
EntityId | $requestId, |
|
|
int | $requestRevision, |
|
|
WebResponse | $response, |
|
|
string | $data, |
|
|
string | $contentType, |
|
|
string | $lastModified ) |
Output the entity data and set the appropriate HTTP response headers.
- Parameters
-
| WebRequest | $request | |
| EntityId | $requestId | The original entity ID of the request |
| int | $requestRevision | The original revision ID of the request (0 for latest) |
| WebResponse | $response | |
| string | $data | The data to output |
| string | $contentType | The data's mime type |
| string | $lastModified | |
◆ purgeWebCache()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::purgeWebCache |
( |
EntityId | $id, |
|
|
int | $revision ) |
Purges the entity data identified by the doc parameter from any HTTP caches.
- Parameters
-
| EntityId | $id | The entity ID for which to purge all data. |
| int | $revision | The revision ID (0 for current/unspecified) |
◆ validateRedirectability()
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::validateRedirectability |
( |
EntityId | $id, |
|
|
EntityId | $redirectTargetId ) |
|
private |
◆ $defaultFormat
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$defaultFormat |
|
private |
◆ $entityDataFormatProvider
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$entityDataFormatProvider |
|
private |
◆ $entityIdParser
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$entityIdParser |
|
private |
◆ $entityRedirectLookup
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$entityRedirectLookup |
|
private |
◆ $entityRevisionLookup
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$entityRevisionLookup |
|
private |
◆ $entityTypesWithoutRdfOutput
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$entityTypesWithoutRdfOutput |
|
private |
◆ $frameOptionsHeader
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$frameOptionsHeader |
|
private |
◆ $htmlCacheUpdater
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$htmlCacheUpdater |
|
private |
◆ $logger
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$logger |
|
private |
◆ $maxAge
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$maxAge |
|
private |
◆ $serializationService
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$serializationService |
|
private |
◆ $subEntityTypesMap
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$subEntityTypesMap |
|
private |
◆ $uriManager
| Wikibase\Repo\LinkedData\EntityDataRequestHandler::$uriManager |
|
private |
◆ MAXIMUM_MAX_AGE
| const Wikibase\Repo\LinkedData\EntityDataRequestHandler::MAXIMUM_MAX_AGE = 2678400 |
|
private |
◆ MINIMUM_MAX_AGE
| const Wikibase\Repo\LinkedData\EntityDataRequestHandler::MINIMUM_MAX_AGE = 0 |
|
private |
Allowed smallest and biggest number of seconds for the "max-age=..." and "s-maxage=..." cache control parameters.
- Todo
- Hard maximum could be configurable somehow.
The documentation for this class was generated from the following file: