RequestHandler
class RequestHandler implements ContainerInjectionInterface (View source)
Acts as intermediate request forwarder for resource plugins.
Properties
| protected SerializerInterface|DecoderInterface | $serializer | The serializer. |
Methods
Creates a new RequestHandler instance.
Instantiates a new instance of this class.
Handles a REST API request.
Handles a REST API request without deserializing the request body.
Prepares the REST resource response.
Gets the normalized HTTP request method of the matched route.
Deserializes request body, if any.
Delegates an incoming request to the appropriate REST resource plugin.
Creates an argument resolver, containing all REST parameters.
Details
__construct(SerializerInterface $serializer)
Creates a new RequestHandler instance.
static
create(ContainerInterface $container)
Instantiates a new instance of this class.
This is a factory method that returns a new instance of this class. The factory should pass any needed dependencies into the constructor of this class, but not the container itself. Every call to this method must return a new instance of this class; that is, it may not implement a singleton.
ResourceResponseInterface|Response
handle(RouteMatchInterface $route_match, Request $request, RestResourceConfigInterface $_rest_resource_config)
Handles a REST API request.
Response|ResourceResponseInterface
handleRaw(RouteMatchInterface $route_match, Request $request, RestResourceConfigInterface $_rest_resource_config)
Handles a REST API request without deserializing the request body.
protected ResourceResponseInterface
prepareResponse(ResourceResponseInterface $response, RestResourceConfigInterface $resource_config)
Prepares the REST resource response.
static protected string
getNormalizedRequestMethod(RouteMatchInterface $route_match)
Gets the normalized HTTP request method of the matched route.
protected array|null
deserialize(RouteMatchInterface $route_match, Request $request, ResourceInterface $resource)
Deserializes request body, if any.
protected Response|ResourceResponseInterface
delegateToRestResourcePlugin(RouteMatchInterface $route_match, Request $request, mixed|null $unserialized, ResourceInterface $resource)
Delegates an incoming request to the appropriate REST resource plugin.
protected ArgumentsResolver
createArgumentResolver(RouteMatchInterface $route_match, mixed $unserialized, Request $request)
Creates an argument resolver, containing all REST parameters.