diff --git a/controllers/RController.class.php b/controllers/RController.class.php index 9e081d6c..72b427bd 100644 --- a/controllers/RController.class.php +++ b/controllers/RController.class.php @@ -26,7 +26,9 @@ function GET($matches) { //This will create an instance of a factory depending on which format is set $this->formatterfactory = FormatterFactory::getInstance($matches["format"]); - + $this->formatterfactory->setPackage($package); + $this->formatterfactory->setResource($resourcename); + //This will create an instance of AResource $model = ResourcesModel::getInstance(); $resource = $model->getResource($package,$resourcename); diff --git a/formatters/FormatterFactory.class.php b/formatters/FormatterFactory.class.php index 36182fda..f30f4e72 100644 --- a/formatters/FormatterFactory.class.php +++ b/formatters/FormatterFactory.class.php @@ -105,5 +105,20 @@ public function getPrinter($rootname, $objectToPrint){ include_once("formatters/". $this->format . ".class.php"); return new $format($rootname, $objectToPrint); } + + private $package = "", $resource = ""; + public function setPackage($package){ + $this->package = $package; + } + public function getPackage(){ + return $this->package; + } + + public function setResource($resource){ + $this->resource = $resource; + } + public function getResource(){ + return $this->resource; + } } ?> diff --git a/index.php b/index.php new file mode 100644 index 00000000..991a549a --- /dev/null +++ b/index.php @@ -0,0 +1,9 @@ + diff --git a/router.php b/router.php index 41754b62..6c60be65 100644 --- a/router.php +++ b/router.php @@ -43,8 +43,7 @@ // explanation of the last part of regex: // continue the REST parameters as long as no . is encountered. Continue format as long as no ? or end of URI occurs // /package/resource/rest/para/meters.json?para=meter&filt=er - '/(?P[^/]*)/(?P[^/]*)/?(?P[^.]*)\.(?P[^?]*).*' => 'RController', - + '/(?P[^/]*)/(?P[^/]*)/?(?P([^.]*\.)*(?P[^?/]*)).*' => 'RController', // Calling the Create, Update, Delete- controller // This is a request on the real-world object // examples of matches: