Skip to content
Snippets Groups Projects
Commit 553d9b52 authored by alvaro's avatar alvaro
Browse files

New feature: Adding extension (i.e., .html, .rdf, .json) to a service name...

New feature: Adding extension (i.e., .html, .rdf, .json) to a service name will force it to serve in that particular content
parent cb3bda20
No related branches found
No related tags found
No related merge requests found
......@@ -13,9 +13,22 @@ class ServiceModule extends abstractModule{
if(sizeof($qArr)==0){
return FALSE;
}
//Use .extension at the end of the service to force a particular content type
if(strpos($qArr[0], '.')>0){
$aux = explode(".", $qArr[0]);
if(isset($aux[1])){
$contentTypes = $conf['http_accept'][$aux[1]];
if($contentTypes == null){
Utils::send406("Content type not acceptable\n");
}
$acceptContentType = $contentTypes[0];
}
$qArr[0] = $aux[0];
}
$extension = Utils::getExtension($acceptContentType);
$viewFile = null;
$lodspk['model'] = $conf['model']['directory'].'/'.$conf['service']['prefix'].'/'.$qArr[0].'/';
$lodspk['view'] = $conf['view']['directory'].'/'.$conf['service']['prefix'].'/'.$qArr[0].'/'.$extension.'.template';
$modelFile = $lodspk['model'].$extension.'.queries';
......@@ -59,7 +72,7 @@ class ServiceModule extends abstractModule{
$params = array();
$params = $this->getParams($localUri);
//$params[] = $context;
$acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']);
//$acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']);
$extension = Utils::getExtension($acceptContentType);
$args = array();
list($modelFile, $viewFile) = $service;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment