public function getFormat($mediatype = false)
    {
        if (!isset($this->_format))
        {
            if(!$this->query->has('format'))
            {
                $format = pathinfo($this->getUrl()->getPath(), PATHINFO_EXTENSION);

                if(empty($format) || !isset(static::$_formats[$format]))
                {
                    $format = 'html'; //define html default

                    if ($this->_headers->has('Accept'))
                    {
                        $accept  = $this->_headers->get('Accept');
                        $formats = $this->__parseAccept($accept);

                        /**
                         * If the browser is requested text/html serve it at all times
                         *
                         * @hotfix #409 : Android 2.3 requesting application/xml
                         */
                        if (!isset($formats['text/html']))
                        {
                            //Get the highest quality format
                            $mime_type = key($formats);

                            foreach (static::$_formats as $value => $mime_types)
                            {
                                if (in_array($mime_type, (array)$mime_types)) {
                                    $format = $value;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else $format = $this->query->get('format', 'word');

            $this->setFormat($format);
        }

        return $mediatype ? static::$_formats[$this->_format][0] : $this->_format;
    }