Beispiel #1
0
 /**
  * to check whether the resource represented  by the $resourceBox has any
  * BLOB associated with it, which is to be saved using HTTP PUT.
  * HTTP PUT will be used to save a BLOB when the assoicated MLE (resource)
  * is already exists in the OData service, which means state of the resource
  *  will be unchanged or modified.
  *
  * @param ResourceBox $resourceBox
  * @Return HttpRequest
  * @throws InvalidOperation
  */
 protected function CheckAndProcessMediaEntryPut($resourceBox)
 {
     if ($resourceBox->SaveStream == null) {
         return null;
     }
     $editMediaResourceUri = $resourceBox->GetEditMediaResourceUri($this->_context->GetBaseUriWithSlash());
     if ($editMediaResourceUri == null) {
         throw new InvalidOperation(Resource::SetSaveStreamWithoutEditMediaLink);
     }
     //Hack: If we are using Windows Auth, with PUT operation, then Curl will throw the error
     //"necessary data rewind wasn't possible in ..", so fix is use POST Tunneling for this
     //request and after creating the request reset it to default value.
     $usePostTuneling = $this->_context->UsePostTunneling;
     $this->_context->UsePostTunneling = true;
     $mediaResourceRequest = $this->CreateMediaResourceRequest($editMediaResourceUri, HttpVerb::PUT);
     $this->_context->UsePostTunneling = $usePostTuneling;
     $this->SetupMediaResourceRequest($mediaResourceRequest, $resourceBox);
     //TODO: Add E-Tag
     return $mediaResourceRequest;
 }