コード例 #1
0
ファイル: DataService2.php プロジェクト: i-geo/odataphpprod
 public function handleRequest()
 {
     try {
         $this->createProviders();
         $this->_dataServiceHost->validateQueryParameters();
     } catch (\Exception $exception) {
         ErrorHandler::handleException($exception, $this);
         //TODO we are done call HTTPOUTPUT and remove exit
         exit;
     }
     $ObjectModelInstance = null;
     try {
         $uriProcessor = null;
         $uriProcessor = UriProcessor::process($this);
         $this->serializeResult($uriProcessor->getRequestDescription(), $uriProcessor);
     } catch (\Exception $exception) {
         ErrorHandler::handleException($exception, $this);
         //TODO we are done call HTTPOUTPUT and remove exit
         exit;
     }
 }
コード例 #2
0
 /**
  * Top-level handler invoked by Dispatcher against any request to this 
  * service. This method will hand over request processing task to other 
  * functions which process the request, set required headers and Response 
  * stream (if any in Atom/Json format) in 
  * WebOperationContext::Current()::OutgoingWebResponseContext.
  * Once this function returns, dispatcher uses global WebOperationContext 
  * to write out the request response to client.
  * This function will perform the following operations:
  * (1) Check whether the top level service class implements 
  *     IServiceProvider which means the service is a custom service, in 
  *     this case make sure the top level service class implements 
  *     IDataServiceMetaDataProvider and IDataServiceQueryProvider. 
  *     These are the minimal interfaces that a custom service to be 
  *     implemented in order to expose its data as OData. Save reference to
  *     These interface implementations. 
  *     NOTE: Here we will ensure only providers for IDSQP and IDSMP. The 
  *     IDSSP will be ensured only when there is an GET request on MLE/Named 
  *     stream.
  *  
  * (2). Invoke 'InitializeService' method of top level service for 
  *      collecting the configuration rules set by the developer for this 
  *      service. 
  *  
  * (3). Invoke the Uri processor to process the request URI. The uri 
  *      processor will do the following:
  *      (a). Validate the request uri syntax using OData uri rules
  *      (b). Validate the request using metadata of this service
  *      (c). Parse the request uri and using, IDataServiceQueryProvider 
  *           implementation, fetches the resources pointed by the uri 
  *           if required
  *      (d). Build a RequestDescription which encapsulate everything 
  *           related to request uri (e.g. type of resource, result 
  *           etc...)
  * (3). Invoke handleRequest2 for further processing
  * 
  * @return void
  */
 public function handleRequest()
 {
     try {
         $this->createProviders();
         $this->_dataServiceHost->validateQueryParameters();
         $requestMethod = $this->getOperationContext()->incomingRequest()->getMethod();
         if ($requestMethod !== ODataConstants::HTTP_METHOD_GET) {
             ODataException::createNotImplementedError(Messages::dataServiceOnlyReadSupport($requestMethod));
         }
     } catch (\Exception $exception) {
         ErrorHandler::handleException($exception, $this);
         // Return to dispatcher for writing serialized exception
         return;
     }
     $uriProcessor = null;
     try {
         $uriProcessor = UriProcessor::process($this);
         $requestDescription = $uriProcessor->getRequestDescription();
         $this->serializeResult($requestDescription, $uriProcessor);
     } catch (\Exception $exception) {
         ErrorHandler::handleException($exception, $this);
         // Return to dispatcher for writing serialized exception
         return;
     }
     // Return to dispatcher for writing result
 }