public function RequestHandler::handle in Drupal 8
Same name and namespace in other branches
- 9 core/modules/rest/src/RequestHandler.php \Drupal\rest\RequestHandler::handle()
Handles a REST API request.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match.
\Symfony\Component\HttpFoundation\Request $request: The HTTP request object.
\Drupal\rest\RestResourceConfigInterface $_rest_resource_config: The REST resource config entity.
Return value
\Drupal\rest\ResourceResponseInterface|\Symfony\Component\HttpFoundation\Response The REST resource response.
File
- core/
modules/ rest/ src/ RequestHandler.php, line 77
Class
- RequestHandler
- Acts as intermediate request forwarder for resource plugins.
Namespace
Drupal\restCode
public function handle(RouteMatchInterface $route_match, Request $request, RestResourceConfigInterface $_rest_resource_config) {
$resource = $_rest_resource_config
->getResourcePlugin();
$unserialized = $this
->deserialize($route_match, $request, $resource);
$response = $this
->delegateToRestResourcePlugin($route_match, $request, $unserialized, $resource);
return $this
->prepareResponse($response, $_rest_resource_config);
}