Esempio n. 1
0
 /**
  * Handles responses to the OPTIONS request.
  *
  * This method enhances the generated response to indicate WebDAV
  * compliance classes 1 and 2 and adds the methods LOCK and UNLOCK to the
  * Allow header.
  *
  * @param ezcWebdavResponse $response 
  * @return ezcWebdavResponse|null
  */
 public function generatedResponse(ezcWebdavResponse $response)
 {
     if ($response instanceof ezcWebdavOptionsResponse) {
         $response->setHeader('DAV', ezcWebdavOptionsResponse::VERSION_ONE . ',' . ezcWebdavOptionsResponse::VERSION_TWO);
         $allowHeader = $response->getHeader('Allow') . ', LOCK, UNLOCK';
         $response->setHeader('Allow', $allowHeader);
     }
 }
Esempio n. 2
0
 /**
  * Handle a response and send it to the WebDAV client.
  *
  * This method is part of the integral communication API between the WebDAV
  * client and the {@link ezcWebdavServer}. It is declared final to ensure a
  * minimal compatibile API between the extended classes and it is
  * responsible to dispatch the {@link ezcWebdavPluginRegistry} hooks. NOTE:
  * The plugin API is not public, yet, and will be part of a next release.
  *
  * It currently just maps internally to {@link processResponse()} and
  * passes the result to {@ $this->sendResponse()}. It is not recommended
  * that the {@link $this->processResponse()} method is overwritten, because
  * this one takes care about the dispatching. The {@link
  * $this->sendResponse()} may be overwritten, mainly for debugging, testing
  * and logging purposes.
  * 
  * @param ezcWebdavResponse $response
  * @return void
  */
 public final function handleResponse(ezcWebdavResponse $response)
 {
     // Set the Server header with information about eZ Components version
     // and transport implementation.
     $headers = ezcWebdavServer::getInstance()->headerHandler->parseHeaders(array('Server'));
     $response->setHeader('Server', (isset($headers['Server']) && strlen($headers['Server']) > 0 ? $headers['Server'] . '/' : '') . 'eZComponents/' . (self::VERSION === '//auto' . 'gentag//' ? 'dev' : self::VERSION) . '/' . get_class($this));
     try {
         $response->validateHeaders();
         $this->sendResponse($this->flattenResponse($this->processResponse($response)));
     } catch (Exception $e) {
         if ($response instanceof ezcWebdavErrorResponse) {
             // Attention: Recursion detected!
             throw $e;
         }
         $this->handleResponse($this->handleException($e));
         throw $e;
     }
 }