web/lib/Zend/Gdata/App/HttpException.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * Zend Framework
       
     5  *
       
     6  * LICENSE
       
     7  *
       
     8  * This source file is subject to the new BSD license that is bundled
       
     9  * with this package in the file LICENSE.txt.
       
    10  * It is also available through the world-wide-web at this URL:
       
    11  * http://framework.zend.com/license/new-bsd
       
    12  * If you did not receive a copy of the license and are unable to
       
    13  * obtain it through the world-wide-web, please send an email
       
    14  * to license@zend.com so we can send you a copy immediately.
       
    15  *
       
    16  * @category   Zend
       
    17  * @package    Zend_Gdata
       
    18  * @subpackage App
       
    19  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    21  * @version    $Id: HttpException.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    22  */
       
    23 
       
    24 /**
       
    25  * Zend_Gdata_App_Exception
       
    26  */
       
    27 require_once 'Zend/Gdata/App/Exception.php';
       
    28 
       
    29 /**
       
    30  * Zend_Http_Client_Exception
       
    31  */
       
    32 require_once 'Zend/Http/Client/Exception.php';
       
    33 
       
    34 /**
       
    35  * Gdata exceptions
       
    36  *
       
    37  * Class to represent exceptions that occur during Gdata operations.
       
    38  *
       
    39  * @category   Zend
       
    40  * @package    Zend_Gdata
       
    41  * @subpackage App
       
    42  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    43  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    44  */
       
    45 class Zend_Gdata_App_HttpException extends Zend_Gdata_App_Exception
       
    46 {
       
    47 
       
    48     protected $_httpClientException = null;
       
    49     protected $_response = null;
       
    50 
       
    51     /**
       
    52      * Create a new Zend_Gdata_App_HttpException
       
    53      *
       
    54      * @param  string $message Optionally set a message
       
    55      * @param Zend_Http_Client_Exception Optionally pass in a Zend_Http_Client_Exception
       
    56      * @param Zend_Http_Response Optionally pass in a Zend_Http_Response
       
    57      */
       
    58     public function __construct($message = null, $e = null, $response = null)
       
    59     {
       
    60         $this->_httpClientException = $e;
       
    61         $this->_response = $response;
       
    62         parent::__construct($message);
       
    63     }
       
    64 
       
    65     /**
       
    66      * Get the Zend_Http_Client_Exception.
       
    67      *
       
    68      * @return Zend_Http_Client_Exception
       
    69      */
       
    70     public function getHttpClientException()
       
    71     {
       
    72         return $this->_httpClientException;
       
    73     }
       
    74 
       
    75     /**
       
    76      * Set the Zend_Http_Client_Exception.
       
    77      *
       
    78      * @param Zend_Http_Client_Exception $value
       
    79      */
       
    80     public function setHttpClientException($value)
       
    81     {
       
    82         $this->_httpClientException = $value;
       
    83         return $this;
       
    84     }
       
    85 
       
    86     /**
       
    87      * Set the Zend_Http_Response.
       
    88      *
       
    89      * @param Zend_Http_Response $response
       
    90      */
       
    91     public function setResponse($response)
       
    92     {
       
    93         $this->_response = $response;
       
    94         return $this;
       
    95     }
       
    96 
       
    97     /**
       
    98      * Get the Zend_Http_Response.
       
    99      *
       
   100      * @return Zend_Http_Response
       
   101      */
       
   102     public function getResponse()
       
   103     {
       
   104         return $this->_response;
       
   105     }
       
   106 
       
   107     /**
       
   108      * Get the body of the Zend_Http_Response
       
   109      *
       
   110      * @return string
       
   111      */
       
   112     public function getRawResponseBody()
       
   113     {
       
   114         if ($this->getResponse()) {
       
   115             $response = $this->getResponse();
       
   116             return $response->getRawBody();
       
   117         }
       
   118         return null;
       
   119     }
       
   120 
       
   121 }