function setTarget($target = null, $preserveHost = true)
    {
        $target = (string) $target;
        if (empty($target) && $target !== "0")
            $target = '/';
        
        // validate uri
        if (parse_url($target) === false)
        {
            $target = rawurlencode($target);

            /*
            throw new \InvalidArgumentException(sprintf(
                'Malformed URI: (%s).'
                , $target
            ));
            */
        }

        
        $this->target_uri = (string) $target;
        return $this;
    }