Generate redirect response
765578
def redirect_response(self, url, permanent=False):
        
        if permanent:
            self.send_response(301)
        else:
            self.send_response(302)
        self.send_header("Location", url)
        self.end_headers()
1211644
private void handleRenderRedirect(final PrintWriter writer) {
		UIContext uic = UIContextHolder.getCurrent();
		// Redirect user to error page
		LOG.warn("User will be redirected to " + redirectUrl);

		// Setup response with redirect
		getResponse().setContentType(WebUtilities.CONTENT_TYPE_XML);
		writer.write(XMLUtil.getXMLDeclarationWithThemeXslt(uic));

		writer.print("<ui:ajaxresponse ");
		writer.print(XMLUtil.UI_NAMESPACE);
		writer.print(">");
		writer.print("<ui:ajaxtarget id=\"" + triggerId + "\" action=\"replace\">");

		// Redirect URL
		writer.print("<ui:redirect url=\"" + redirectUrl + "\" />");

		writer.print("</ui:ajaxtarget>");
		writer.print("</ui:ajaxresponse>");
	}
194811
public function createRedirectResponse(View $view, $location, $format)
    {
        $content = null;
        if ((Response::HTTP_CREATED === $view->getStatusCode() || Response::HTTP_ACCEPTED === $view->getStatusCode()) && null !== $view->getData()) {
            $response = $this->initResponse($view, $format);
        } else {
            $response = $view->getResponse();
            if ('html' === $format && isset($this->forceRedirects[$format])) {
                $redirect = new RedirectResponse($location);
                $content = $redirect->getContent();
                $response->setContent($content);
            }
        }

        $code = isset($this->forceRedirects[$format])
            ? $this->forceRedirects[$format] : $this->getStatusCode($view, $content);

        $response->setStatusCode($code);
        $response->headers->set('Location', $location);

        return $response;
    }
230540
def get(self, url, **kwargs):
        
        """

        kwargs.setdefault('allow_redirects', True)
        return self.request('GET', url, **kwargs)
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)
177522
private function generateResponse($request)
    {
        $context  = stream_context_create(
            array(
                'http' => array(
                    'method'  => "POST",
                    'header'  => "Content-Type: text/xml",
                    'content' => $request
                )
            )
        );
        $file     = file_get_contents(self::SEARCH_URL, false, $context);
        $response = xmlrpc_decode($file);

        return $response;
    }
1072503
function(options, callback, opt_data) {
  var request = http.request(options, function(response) {
    if (response.statusCode == 302 || response.statusCode == 303) {
      try {
        var location = url.parse(response.headers['location']);
      } catch (ex) {
        callback(Error(
            'Failed to parse "Location" header for server redirect: ' +
            ex.message + '\nResponse was: \n' +
            new HttpResponse(response.statusCode, response.headers, '')));
        return;
      }

      if (!location.hostname) {
        location.hostname = options.host;
        location.port = options.port;
      }

      request.abort();
      sendRequest({
        method: 'GET',
        host: location.hostname,
        path: location.pathname + (location.search || ''),
        port: location.port,
        headers: {
          'Accept': 'application/json; charset=utf-8'
        }
      }, callback);
      return;
    }

    var body = [];
    response.on('data', body.push.bind(body));
    response.on('end', function() {
      var resp = new HttpResponse(response.statusCode,
          response.headers, body.join('').replace(/\0/g, ''));
      callback(null, resp);
    });
  });

  request.on('error', function(e) {
    if (e.code === 'ECONNRESET') {
      setTimeout(function() {
        sendRequest(options, callback, opt_data);
      }, 15);
    } else {
      var message = e.message;
      if (e.code) {
        message = e.code + ' ' + message;
      }
      callback(new Error(message));
    }
  });

  if (opt_data) {
    request.write(opt_data);
  }

  request.end();
}
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
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))
458586
def redirect(self, redirect_url=None, message=None, level="info"):
        
        if redirect_url is None:
            redirect_url = self.back_url
        if message is not None:
            self.add_status_message(message, level)
        return self.request.response.redirect(redirect_url)
868796
function renderResponse(res, postUrl) {
    options.fault = options.fault || {};

    var fault = templates['soapFault']({
      code:         options.fault.code,
      description:  options.fault.description
    });

    var form = options.formTemplate ?
      interpolate(options.formTemplate) : templates[(!options.plain_form ? 'form' : 'form_el')];

    res.set('Content-Type', 'text/html');
    res.send(form({
      callback: postUrl,
      wctx:     options.wctx,
      wresult:  fault
    }));
  }
64818
def is_redirect(self):
        ''''''
        if self._response:
            status_code = self._response.status_code
            return status_code in self._codes \
                or status_code in self._repeat_codes
1332929
def redirect(url, code=None):
    
    if not code:
        code = 303 if request.get('SERVER_PROTOCOL') == "HTTP/1.1" else 302
    res = response.copy(cls=HTTPResponse)
    res.status = code
    res.body = ""
    res.set_header('Location', urljoin(request.url, url))
    raise res
715560
function(req, res, response) {

  if (response.status === 302) {
    var location = response.headers.location;
    delete response.headers.location;
    res.set(response.headers);
    res.redirect(location);
  } else {
    res.set(response.headers);
    res.status(response.status).send(response.body);
  }
}
967063
function create (options) {
  const {
    xForwardedProto,
    redirectPort,
    redirectHost,
    statusCode,
    redirectUnknown,
    redirect,
    exclude
  } = Object.assign({}, defaults, options)
  const _port = redirectPort === 443 ? '' : (': ' + redirectPort)

  return function redirectSSL (req, res, next) {
    if (redirect && !isExcluded(req.url, exclude)) {
      const _isHttps = isHTTPS(req, xForwardedProto)
      const shouldRedirect = _isHttps === false || (redirectUnknown && _isHttps === null)
      if (shouldRedirect) {
        const ـredirectURL = 'https://' + (redirectHost || req.headers.host) + _port + req.url
        res.writeHead(statusCode, { Location: ـredirectURL })
        return res.end()
      }
    }

    return next()
  }
}
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)
1365324
def do_response(self, response_id):
        '''
        '''
        if response_id != Gtk.ResponseType.OK:
            return
        filelist = []
        for row in self.rows:
            if row[1].get_text() == row[2].get_text():
                continue
            filelist.append({'path': row[0], 'newname': row[2].get_text()})
        if len(filelist) == 0:
            return
        pcs.rename(self.app.cookie, self.app.tokens, filelist)
        gutil.async_call(pcs.rename, self.app.cookie, self.app.tokens,
                         filelist, callback=self.app.reload_current_page)