public function dispatch() { if (!$this->_transaction) { $this->_transaction = new Prest_Transaction(); } $response = null; try { $request = new Prest_Request(array('service' => $this)); if (!$request->isGet()) { $this->_transaction->begin(); } $representation = $this->_dispatcher->dispatch($request); $response = new Prest_Response($representation); if ($this->_transaction->isStarted()) { $this->_transaction->finish(); } $response->send(); } catch (Prest_Exception $e) { $this->_handlePrestException($e); } catch (Exception $e) { $this->_handleErrorException($e); } }