/**
* Called on successful routing of a service call
* Prepares the service to a request to be rendered
*
* @return boolean $result - if false then fail fast no call to runCallMethod() should be made.
*/
protected function setupRequest()
{
// Make sure we have a route matched (this should caught and an exception thrown on Manager::determineRoute())
if (!$this->matched_route instanceof RouteMetaData) {
return false;
}
// Proceed to run the service action
if ($this->matched_route->isExposeDisabled()) {
return true;
}
// If its a GET request and no expose fields are present, fail early
if ($this->getRequest()->getHttpMethod() == Request::METHOD_GET) {
$expose = $this->matched_route->getExpose();
if (count($expose) === 0 || count($expose) == 1 && empty($expose[0])) {
$this->renderDeterminedRepresentation($this->getActionInstance()->createResultSet(array()));
return false;
}
}
return true;
}