示例#1
0
 public function handleRequest()
 {
     $this->createProviders();
     $this->getHost()->validateQueryParameters();
     $requestMethod = $this->getOperationContext()->incomingRequest()->getMethod();
     if ($requestMethod != HTTPRequestMethod::GET()) {
         throw ODataException::createNotImplementedError(Messages::onlyReadSupport($requestMethod));
     }
     return UriProcessor::process($this);
 }
示例#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 
  *     IMetaDataProvider and IQueryProvider.
  *     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 'Initialize' 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, IQueryProvider
  *           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->_serviceHost->validateQueryParameters();
         $requestMethod = $this->getOperationContext()->incomingRequest()->getMethod();
         if ($requestMethod != HTTPRequestMethod::GET()) {
             throw ODataException::createNotImplementedError(Messages::onlyReadSupport($requestMethod));
         }
         $uriProcessor = UriProcessor::process($this);
         $request = $uriProcessor->getRequest();
         $this->serializeResult($request, $uriProcessor);
     } catch (\Exception $exception) {
         ErrorHandler::handleException($exception, $this);
         // Return to dispatcher for writing serialized exception
         return;
     }
 }