function rest_server_server in Services 7.3
Same name and namespace in other branches
- 6.3 servers/rest_server/rest_server.module \rest_server_server()
Starting point of the REST server.
Return value
type
File
- servers/
rest_server/ rest_server.module, line 23
Code
function rest_server_server() {
$endpoint_path = services_get_server_info('endpoint_path', 'services/rest');
$services_rest_server_factory = variable_get('services_rest_server_factory_class', 'ServicesRESTServerFactory');
$rest_server_factory = new $services_rest_server_factory(array(
'endpoint_path' => $endpoint_path,
));
/* @var $rest_server RESTServer */
$rest_server = $rest_server_factory
->getRESTServer();
$canonical_path = $rest_server
->getCanonicalPath();
if (empty($canonical_path)) {
$endpoint_name = services_get_server_info('endpoint', '');
$endpoint = services_endpoint_load($endpoint_name);
return t('Services Endpoint "@name" has been setup successfully.', array(
'@name' => $endpoint->name,
));
}
try {
return $rest_server
->handle();
} catch (Exception $e) {
$rest_server
->handleException($e);
}
}