예제 #1
0
파일: RestClient.php 프로젝트: rexmac/zf2
 /**
  * Call a remote REST web service URI and return the Zend_Http_Response object
  *
  * @param  string $path            The path to append to the URI
  * @throws Zend\Rest\Client\Exception\UnexpectedValueException
  * @return void
  */
 private final function _prepareRest($path)
 {
     // Get the URI object and configure it
     if (!$this->_uri instanceof URI\Uri) {
         throw new Exception\UnexpectedValueException('URI object must be set before performing call');
     }
     $uri = $this->_uri->generate();
     if ($path[0] != '/' && $uri[strlen($uri) - 1] != '/') {
         $path = '/' . $path;
     }
     $this->_uri->setPath($path);
     /**
      * Get the HTTP client and configure it for the endpoint URI.  Do this 
      * each time as the Zend\Http\Client instance may be shared with other 
      * Zend\Service\AbstractService subclasses.
      */
     $this->getHttpClient()->resetParameters()->setUri($this->_uri);
 }