public static function createFromRequest(Request $request)
    {
        $rowUrl = urldecode(Utils::getParamValue($request, Utils::$PARAMETER_URL,
                        Utils::$METHOD_GET, false));
        $rowUrl = parse_url($rowUrl);
        if (empty($rowUrl["host"]))
        {
            throw new HTTPStatus502Exception("The host is not defined", 502);
        }
        $getParams = array();
        if (isset($rowUrl["query"]))
        {
            parse_str($rowUrl["query"], $getParams);
            unset($rowUrl["query"]);
        }

        $allParams = Utils::getAllParams($request);

        if (isset($allParams[Utils::$METHOD_GET]) &&
                isset($allParams[Utils::$METHOD_GET][Utils::$PARAMETER_URL]))
        {
            unset($allParams[Utils::$METHOD_GET][Utils::$PARAMETER_URL]);
        }
        $content    = null;
        $postParams = array();
        if (isset($allParams[Utils::$CONTENT]) || isset($allParams[Utils::$METHOD_POST]))
        {
            $method     = Utils::$METHOD_POST;
            $content    = isset($allParams[Utils::$CONTENT]) ?
                $allParams[Utils::$CONTENT] : $request->getContent();
            $postParams = isset($allParams[Utils::$METHOD_POST]) ?
                    $allParams[Utils::$METHOD_POST] : array();
            // if url containts more get parameters
            if (!empty($allParams[Utils::$METHOD_GET])) {
                $postParams = array_merge($postParams,
                        $allParams[Utils::$METHOD_GET]);
            }
        }
        else
        {
            $method        = Utils::$METHOD_GET;
            $getParamshelp = isset($allParams[Utils::$METHOD_GET]) ?
                    $allParams[Utils::$METHOD_GET] : array();
            $getParams     = array_merge($getParams, $getParamshelp);
        }
        $headers = Utils::getHeadersFromRequest($request);

        $headers['Host'] = $rowUrl['host'];

        return new ProxyQuery($rowUrl, $method, $content, $getParams,
                $postParams, $headers);
    }