You are here

public function RestfulManager::process in RESTful 7.2

Processes the request to produce a response.

Return value

Response The response being sent back to the consumer via the menu callback.

File

src/RestfulManager.php, line 194
Contains \Drupal\restful\RestfulManager.

Class

RestfulManager

Namespace

Drupal\restful

Code

public function process() {

  // Gets the appropriate resource plugin (based on the request object). That
  // plugin processes the request according to the REST principles.
  $data = $this->resourceManager
    ->process();

  // Formats the data based on the negotiatied output format. It accesses to
  // the request information via the service container.
  $body = $this->formatterManager
    ->format($data);

  // Prepares the body for the response. At this point all headers have been
  // added to the response.
  $this->response
    ->setContent($body);

  // The menu callback function is in charge of adding all the headers and
  // returning the body.
  return $this->response;
}