/** * @return \Components\Io_Mimetype */ public function getMimetype() { if (null === $this->m_mimeType) { if (!($this->m_mimeType = Io_Mimetype::forFileName($this->m_uri->getPath()))) { $this->m_mimeType = Io_Mimetype::TEXT_HTML(Io_Charset::UTF_8()); } } return $this->m_mimeType; }
/** * @param \Components\Uri $uri_ */ public function dispatch(Uri $uri_, $method_ = null) { ob_start(); try { $this->dispatchImpl($uri_, $method_); } catch (\Exception $e) { if (Runtime::isCli()) { throw $e; } Runtime::addException($e); if ($e instanceof Http_Exception) { $e->sendHeader(); } } // FIXME Why?? if (Runtime::isCli()) { echo ob_get_clean(); } else { ob_flush(); /** * Do not corrupt output for other mimetypes - assuming: * - Exceptions are logged * - Debug output & exceptions are sent via headers * * Visualization happens via client side / logging or * custom implementations of http/scriptlet#dispatch. */ if (false === Io_Mimetype::TEXT_HTML()->equals($this->getResponse()->getMimetype())) { Debug::clear(); Runtime::clearExceptions(); } if (session_id()) { session_write_close(); } } }
public function __construct($content_, Io_Charset $charset_) { parent::__construct($content_, md5($content_), Io_Mimetype::TEXT_HTML($charset_)); $this->encoding = Mail_Part::CONTENT_ENCODING_BASE64; }