注销登录状态

            参数:
                redirect_url    跳转链接，为 None 时不跳转 (Ajax 可能用得到)。
176637
def signout(self, redirect_url = "/"):
        
        self.clear_cookie(self._USER_NAME)
        if redirect_url: self.redirect(redirect_url)
857310
def get_redirect(self):
        
        index_url = self.appbuilder.get_url_for_index
        page_history = Stack(session.get("page_history", []))

        if page_history.pop() is None:
            return index_url
        session["page_history"] = page_history.to_json()
        url = page_history.pop() or index_url
        return url
1291396
static function redirectPostAsParameter($inner_url = null){
        if($inner_url === NULL){
            $inner_url_arr = self::$request->getParameter();
        }else{
            $inner_url_obj = new \Hiano\Route\InnerUrl(self::getModuleName(), self::getControllerName(), self::getActionName());
            $inner_url_arr = $inner_url_obj->parse($inner_url);
        }
        $ps = self::$request->getPost();
        $arr = array_merge($inner_url_arr,$ps);
        $url = self::getRouter()->format($arr);
        self::redirectOut($url);
    }
1204797
function Request_redirect(url, isTemp) {
        logger.info('Request.redirect:', {
            url: url,
            isTemp: isTemp
        });
        this.addHeader('Location', url);
        this.stopPromiseChain();
        this.isRendered = true;
        if (Type.isBoolean(isTemp) && !!isTemp) {
            this.response.writeHead(302, this.headers);
        } else {
            this.response.writeHead(301, this.headers);
        }
        this.response.end('Redirect to:' + url);
    }
1171340
def param_redirect(request, viewname, *args):
    
    url = reverse(viewname, PARAMS_URL_CONF, args)
    params = request.GET.urlencode().split('&')

    if hasattr(request, 'cparam'):
        for k, v in request.cparam.items():
            params.append('{0}={1}'.format(k, v))

    new_params = '&'.join(x for x in params if x != '')
    if len(new_params) > 0:
        return HttpResponseRedirect('{0}?{1}'.format(url, new_params))
    return HttpResponseRedirect(url)
460398
def redirect(view=None, url=None, **kwargs):
    
    if view:
        if url:
            kwargs["url"] = url
        url = flask.url_for(view, **kwargs)
    current_context.exit(flask.redirect(url))
1188242
function sendRequest(method, path, data, callback) {
  if (!CONFIG.isInitialized) {
    throw ERROR_MESSAGE.initializeRequired;
  }

  log("==================================================");
  log("The data below will be sent");
  log("==================================================");
  log(data);

  let dataString = querystring.stringify(data);

  let headers = {
    "Content-Type": "application/x-www-form-urlencoded"
  };

  // 使用 POST 時設定 Content-Length 標頭
  if (method === "POST") {
    headers["Content-Length"] = dataString.length;
  } else {
    path = `${path}?${dataString}`;
  }

  let options = {
    host: CONFIG.host,
    port: CONFIG.port,
    path: path,
    method: method,
    headers: headers
  };

  let request;
  if (!CONFIG.useSSL) {
    request = http.request(options);
  } else {
    request = https.request(options);
  }

  log("==================================================");
  log("HTTP/HTTPS request options");
  log("==================================================");
  log(options);

  if (method === "POST") {
    log("==================================================");
    log("Send request");
    log("==================================================");
    log(dataString);
    request.write(dataString);
  }

  request.end();

  let buffer = "";
  request.on("response", (response) => {
    response.setEncoding("utf8");

    response.on("data", (chunk) => {
      buffer += chunk;
    });

    response.on("end", () => {
      let responseData;

      log("==================================================");
      log("Response data");
      log("==================================================");
      log(buffer);

      if (callback) {
        let err = undefined;

        // 另外處理非 JSON 物件的返回值
        if (NON_JSON_RESPONSE_ENDPOINT.indexOf(path) > -1) {
          if (response.statusCode === 200) {
            if (path === ENDPOINT.aioChargeback) {
              let [status, message] = buffer.split("|");
              responseData = {
                status: status,
                message: message
              };
            } else {
              responseData = {};
              let responseArr = buffer.split("&");
              responseArr.forEach((param) => {
                let [key, value] = param.split("=");
                responseData[key] = value;
              });
            }
          } else {
            err = response.statusCode;
          }
        } else {
          try {
            responseData = JSON.parse(buffer);
          } catch (error) {
            log("==================================================");
            log("Could not convert API response to JSON, the error below is ignored and raw API response is returned to client");
            log("==================================================");
            log(error);
            err = error;
          }
        }

        callback(err, responseData);
      }
    });

    response.on("close", (err) => {
      log("==================================================");
      log("Problem with API request detailed stacktrace below");
      log("==================================================");
      log(err);
      sendErrorResponse(err, callback);
    });
  });

  request.on("error", (err) => {
    log("==================================================");
    log("Problem with API request detailed stacktrace below");
    log("==================================================");
    log(err);
    sendErrorResponse(err, callback);
  });
}
344841
def redirect(self, url):
        ''''''
        # TODO: Should we be overriding self.request with the new request?
        new_request = self._parse_request(url=url, handle=self.request.handle)
        log.debug('Redirecting %s to %s', self.request.path, new_request.path)
        return self._dispatch(new_request.path)
766949
def check_if_redirect(url):
    
    response = head(url, headers={'User-Agent': USER_AGENT})
    if response.status_code >= 300 and response.status_code < 400:
        return response.headers['location']

    return None
911680
def redirect_url=(redirect_url)

      if !redirect_url.nil? && redirect_url.to_s.length > 800
        fail ArgumentError, "invalid value for 'redirect_url', the character length must be smaller than or equal to 800."
      end

      @redirect_url = redirect_url
    end
10941
public static void redirect(String url, boolean copyParameters, ServletRequest req, ServletResponse res)
	{
		if(url == null)
		{
			throw new IllegalArgumentException("URL cannot be null");
		}
		String redirectUrl = url;
		char separator = '?';
		if (redirectUrl.indexOf('?') != -1)
		{
			separator = '&';
		}
		if(copyParameters)
		{
			Enumeration e = req.getParameterNames();
			while (e.hasMoreElements())
			{
				String name = (String) e.nextElement();
				String value = req.getParameter(name);
				redirectUrl += separator + name + '=' + value;
				separator = '&';
			}
			e = req.getAttributeNames();
	/*		while (e.hasMoreElements())
			{
				String name = (String) e.nextElement();
				String value = req.getParameter(name);
				redirectUrl += separator + name + '=' + value;
				separator = '&';
			}  */
		}
		System.out.println(new LogEntry("about to redirect to " + redirectUrl));
		try
		{
			((HttpServletResponse)res).sendRedirect(redirectUrl);
		}
		catch(IOException ioe)
		{
			throw new ResourceException("redirect to '" + redirectUrl + "' failed with message: " +
			ioe.getMessage(), ioe);
		}
	}
884573
function httpRedirect (url, code) {
    // default to 302 redirect code
    if (!code) {
        code = 302
    }
    // create new error
    var err = new Error('Redirect')
    err.code = code
    err.url = url
    // throw error which will be handled by application framework
    throw err
}
1275575
def redirect(uri, *args)
      if env['HTTP_VERSION'] == 'HTTP/1.1' and env["REQUEST_METHOD"] != 'GET'
        status 303
      else
        status 302
      end

      # According to RFC 2616 section 14.30, "the field value consists of a
      # single absolute URI"
      response['Location'] = uri(uri, settings.absolute_redirects?, settings.prefixed_redirects?)
      halt(*args)
    end
136248
public function setRedirectUri($redirect_uri)
    {
        // $redirect_uri = trim(urldecode($redirect_uri));
        $redirect_uri = trim($redirect_uri);
        if (filter_var($redirect_uri, FILTER_VALIDATE_URL) === false) {
            throw new Exception('$redirect_uri无效');
        }
        $this->_redirect_uri = urlencode($redirect_uri);
    }
1287256
def _parse_request(self, url=None, handle=None):
        '''
        '''
        # To accomdate self.redirect, we need to be able to parse a full url as
        # well
        if url is None:
            url = sys.argv[0]
            if len(sys.argv) == 3:
                url += sys.argv[2]
        if handle is None:
            handle = sys.argv[1]
        return Request(url, handle)
652834
def redirect_ext(to, params_=None, anchor_=None, permanent_=False, args=None, kwargs=None):
    
    if permanent_:
        redirect_class = HttpResponsePermanentRedirect
    else:
        redirect_class = HttpResponseRedirect
    return redirect_class(resolve_url_ext(to, params_, anchor_, args, kwargs))
482381
def page_redirect_url(options = {})
      options = {
        locale: prefix_locale? ? @page.language_code : nil,
        urlname: @page.urlname
      }.merge(options)

      alchemy.show_page_path additional_params.merge(options)
    end