Available options
 redirect_success_path
 redirect_failure_path
 callback_response_path
553946
def url_for(option)
      host = SermepaWebTpv.response_host
      path = SermepaWebTpv.send(option)

      return if !host.present? || !path.present?
      URI.join(host, path).to_s
    end
1233029
function(path, callbackSuccess, callbackError) {
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function() {
    if (xhr.readyState === 4) {
      if (xhr.status >= 200 && xhr.status < 300) {
        callbackSuccess(xhr.responseText);
      } else {
        callbackError();
      }
    }
  };
  xhr.open('GET', path, false);
  try {
    xhr.send();
  } catch (e) {
    callbackError();
  }
}
967464
async def redirect(self, path, status = 302):
        
        location = urljoin(urlunsplit((b'https' if self.https else b'http',
                                                                     self.host,
                                                                     quote_from_bytes(self.path).encode('ascii'),
                                                                     '',
                                                                     ''
                                                                     )), path)
        self.start_response(status, [(b'Location', location)])
        await self.write(b'<a href="' + self.escape(location, True) + b'">' + self.escape(location) + b'</a>')
        await self.flush(True)
1017249
def get_redirect_args(self, request, callback):
        """"""
        callback = force_text(request.build_absolute_uri(callback))
        raw_token = self.get_request_token(request, callback)
        token, secret, _ = self.parse_raw_token(raw_token)
        if token is not None and secret is not None:
            request.session[self.session_key] = raw_token
        args = {
            'oauth_token': token,
            'oauth_callback': callback,
        }

        scope = self.get_scope(request)
        if scope:
            args['scope'] = self.scope_separator.join(self.get_scope(request))

        return args
699898
function(req, res) {
      var defaultString = 'You have successfully logged out.';

      // now respond or redirect
      var postResponse = this._resolvePostAction(waterlock.config.postActions.logout.failure,
        defaultString);

      if (typeof postResponse === 'string' && this._isURI(postResponse)) {
        res.redirect(postResponse);
      } else {
        res.ok(postResponse);
      }
    }
385994
def error_handler(f):
    """"""
    @wraps(f)
    def decorated(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except OAuth2Error as e:
            # Only FatalClientError are handled by Flask-OAuthlib (as these
            # errors should not be redirect back to the client - see
            # http://tools.ietf.org/html/rfc6749#section-4.2.2.1)
            if hasattr(e, 'redirect_uri'):
                return redirect(e.in_uri(e.redirect_uri))
            else:
                return redirect(e.in_uri(oauth2.error_uri))
    return decorated
978961
def get_redirect_args(self, request, callback):
        """"""
        callback = request.build_absolute_uri(callback)
        args = {
            'client_id': self.consumer_key,
            'redirect_uri': callback,
            'response_type': 'code',
        }

        scope = self.get_scope(request)
        if scope:
            args['scope'] = self.scope_separator.join(self.get_scope(request))

        state = self.get_application_state(request, callback)
        if state is not None:
            args['state'] = state
            request.session[self.session_key] = state

        auth_params = self.get_auth_params(request)
        if auth_params:
            args.update(auth_params)

        return args
570740
function resolve(path, options, callback) {
        resolvePath(path, options, function (err, path) {
            if (err) return callback(err);
            callback(null, { path: path });
        });
    }
1180590
def _process_redirect(self):
        ''''''
        _logger.debug('Handling redirect.')

        if self._redirect_tracker.exceeded():
            raise ProtocolError('Too many redirects.')

        try:
            url = self._redirect_tracker.next_location()

            if not url:
                raise ProtocolError('Redirect location missing.')

            if self._redirect_tracker.is_repeat():
                _logger.debug('Got redirect is repeat.')

                request = self._original_request.copy()
                request.url = url
            else:
                request = self._request_factory(url)

            request.prepare_for_send()
        except ValueError as error:
            raise ProtocolError('Invalid redirect location.') from error

        self._next_request = request

        _logger.debug('Updated next redirect request to {0}.'.format(request))
1103202
function catchClientError(req, res, next) {
  const { end } = res;

  res.end = function() {
    // console.log(`Catch client response : ${req.url} ${res.statusCode}`);
    const errorRoute = Route
      .routes('err')
      .filter((obj) => {
        return obj.extra.status === res.statusCode && obj.route !== req.url;
      });

    if(errorRoute.length > 0 && !isRedirect) {
      return redirect(errorRoute[0], req, res, next);
    }

    isRedirect = false;
    end.apply(res, arguments);
  };

  next();
}
405022
def error_redirect(self, errormsg='', errorlog=''):
        '''
        
        '''
        from django.shortcuts import redirect
        self.lti_errormsg = errormsg
        self.lti_errorlog = errorlog
        return redirect(self.build_return_url())
525895
function(options) {
    return function(err, resp) {
      if (err) {
        options.error(err);
      } else {
        options.success(resp);
      }
    };
  }
780568
function resolvePath(path, options, callback) {
        if (!callback) {
            callback = options;
            options = {};
        }
        
        var alreadyRooted = options.alreadyRooted;
        var checkSymlinks = options.checkSymlinks === undefined 
            ? true : options.checkSymlinks;
        var isHome        = false;
        
        if (checkSymlinks === undefined)
            checkSymlinks = true;
        if (path.substr(0, 2) == "~/") {
            isHome = true;
            path = process.env.HOME + path.substr(1);
        }
        else if (!alreadyRooted) 
            path = join(root, path);

        if (checkSymlinks && fsOptions.checkSymlinks && !alreadyRooted) 
            fs.realpath(path, check);
        else check(null, path);

        function check(err, path) {
            if (err) return callback(err);
            
            if (!options.nocheck) {
                if (!(path === base || path.substr(0, root.length) === root)
                  && !isHome) {
                    err = new Error("EACCESS: '" + path + "' not in '" + root + "'");
                    err.code = "EACCESS";
                    return callback(err);
                }
            }
            callback(null, path);
        }
    }
943598
def get_options(server):
    """"""
    try:
        response = requests.options(
            server, allow_redirects=False, verify=False, timeout=5)
    except (requests.exceptions.ConnectionError,
            requests.exceptions.MissingSchema):
        return "Server {} is not available!".format(server)

    try:
        return {'allowed': response.headers['Allow']}
    except KeyError:
        return "Unable to get HTTP methods"
799737
def get_safe_redirect_target(arg='next'):
    
    for target in request.args.get(arg), request.referrer:
        if target:
            redirect_uri = urisplit(target)
            allowed_hosts = current_app.config.get('APP_ALLOWED_HOSTS', [])
            if redirect_uri.host in allowed_hosts:
                return target
            elif redirect_uri.path:
                return uricompose(
                    path=redirect_uri.path,
                    query=redirect_uri.query,
                    fragment=redirect_uri.fragment
                )
    return None
1028438
def _get_link_status_code(link, allow_redirects=False, timeout=5):
    
    status_code = None
    try:
        response = requests.get(
            link, allow_redirects=allow_redirects, timeout=timeout)
        status_code = response.status_code
    except Exception:
        status_code = 404
    return status_code
958732
function(path, callback, opts) {

		if (!callback) callback = function() { };

		var fallbacks = [];
		if (path.each) {
			if (path.length==0) return;
			fallbacks = path;
			path      = fallbacks.shift()+"";
		}

		//Stuff that will make us not want to load files.
		if (this.failedFiles.contains(path)) return;

		opts = opts || {};
		var file = this.worldPath+path+'.js';
		if (opts.rootPath) file = path+'.js';

		var my = this;
		var err;
		var handleData = function(e,raw) {
			data = false;
			if (!raw) {
				err = e;
				my.failedFiles.push(path);
				/* Continue down our list of fallbacks. */
				if (fallbacks.length>0) {
					my.loadFile(fallbacks, callback, opts);
				} else {
					log_error("File not found: "+file);
				}
			} else {
				try { eval('data='+raw); }
				catch (e) { log_error(e); }
			} callback(err, data);
			return data;
		};

		if (opts.sync) {
			try {
				var data = fs.readFileSync(file);
			} catch (e) {
				this.failedFiles.push(path);
				/* Continue down our list of fallbacks. */
				if (fallbacks.length>0) {
					return this.loadFile(fallbacks, callback, opts);
				} else return e;
			} return handleData(false,data);
		} else {
			fs.readFile(file, handleData);
		}
	}