public function setScheme($scheme)
    {
        $this->scheme = null;
        if (empty($scheme) || null === $scheme) {
            return $this;
        }
        $scheme = preg_replace('/[^a-zA-Z0-9\.\:\-]/', '', $scheme);
        $scheme = strtolower($scheme);
        $scheme = rtrim($scheme, ':/');
        $scheme = trim($scheme, ':/');
        $scheme = str_replace('::', ':', $scheme);
        if (strlen($scheme) != 0) {
            if ($this->isRelative()) {
                /* Explained: */
                /* @see Sensimity_Helper_UriTest::testRelativeAbsoluteUrls */
                $exp = explode('/', ltrim($this->getPath(), '/'));
                $this->setHost($exp[0]);
                unset($exp[0]);
                $this->setPath(null);
                $path = implode('/', $exp);
                if (strlen($path) > 0) {
                    //Only create the "/" if theres a path
                    $this->setPath('/' . $path);
                }
                $this->setAbsolute();
            }
            $this->scheme = $scheme;
        }
        return $this;
    }