/** * We override __call to intercept the path and transform * it into a resource and module name, and pass that into the ApidocsComponent. */ public function __call($name, $args) { $pathParams = UtilityComponent::extractPathParams(); $module = ''; $resource = $this->getRequest()->getActionName(); if (count($pathParams)) { if (in_array($this->getRequest()->getActionName(), Zend_Registry::get('modulesEnable'))) { $module = $this->getRequest()->getActionName(); $resource = $pathParams[0]; } } $results = $this->Component->Apidocs->getResourceApiDocs($resource, $module); echo JsonComponent::encode($results); }
/** * This action exposes downloading a single bitstream and should be called as * download/bitstream/<bitstream_id>/... * Any extra parameters are ignored and can be used to force clients like wget to download to the correct filename * if the content-disposition header is ignored by the user agent. * * @throws Zend_Exception */ public function bitstreamAction() { $pathParams = UtilityComponent::extractPathParams(); if (empty($pathParams)) { throw new Zend_Exception('Must specify bitstream id as a path parameter'); } $this->forward('index', null, null, array('bitstream' => $pathParams[0])); }
/** * This should become a RESTful controller for instances. */ public function instanceAction() { UtilityComponent::setTimeLimit(30); // in case an exec call hangs for some odd reason // TODO just plug this into the RESTful stuff $this->disableLayout(); $this->disableView(); $pathParams = UtilityComponent::extractPathParams(); if (empty($pathParams)) { throw new Zend_Exception('Must pass instance id as first path parameter', 400); } $instanceDao = $this->Pvw_Instance->load($pathParams[0]); if (!$instanceDao) { throw new Zend_Exception('Invalid instance id: ' . $pathParams[0], 400); } $this->ModuleComponent->Paraview->killInstance($instanceDao); echo JsonComponent::encode(array('status' => 'ok', 'message' => 'Instance destroyed')); }