Helper function to set the appropriate path metadata

 from - the relative path to the redirect page
 to   - the relative path or absolute URL to the redirect target
517200
def set_paths(from, to)
      @context ||= context
      from = ensure_leading_slash(from)
      data.merge!(
        "permalink" => from,
        "redirect"  => {
          "from" => from,
          "to"   => to =~ %r!^https?://! ? to : absolute_url(to),
        }
      )
    end
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
42771
def set_metadata(self, layer_id, version_id, fp):
        
        base_url = self.client.get_url('VERSION', 'GET', 'single', {'layer_id': layer_id, 'version_id': version_id})
        self._metadata.set(base_url, fp)
582522
function normalizeRedirectPath(redirect, site) {
  return site.path && !redirect.includes(site.path) ? `${site.path}${redirect}` : redirect;
}
1085981
def target_drive=(path_to_drive)
      raise JSS::InvalidDataError, 'Path to target drive must be absolute' unless path_to_drive.to_s.start_with? '/'
      @target_drive = path_to_drive.to_s
      @need_to_update = true
    end
79707
function(callback) {
          var page = apos.data.aposPages.page;
          var _id = page._id;
          $.get('/apos-pages/info', { _id: _id }, function(data) {
            var newPathname = data.slug.replace(/^\/\//, '/');
            apos.redirect(newPathname);
          }).error(function() {
            // If the page no longer exists, navigate away to home page
            apos.redirect('/');
          });
        }
184593
def set_url_path_with_params(context, url_path_str_format):
    
    safe_add_http_request_context_to_behave_context(context)
    table_as_json = dict(context.table)
    url_path = url_path_str_format % table_as_json
    context.http_request_context.url_path = url_path
1338858
public void initializeRelativePath(ServletRequest request, String relativeTo) 
    {
        if ( relativeTo == null )
        {
            relativeTo = _relativeTo;
        }

        if ( relativeTo == null ) return;

        assert ! relativeTo.endsWith("/") : relativeTo;
        String path = getPath();
         
        // If this is a local (relative) path, prefix it with the given 'relativeTo' path, and save a flag.
        // We save this flag in a local variable because the Forward object may be saved/restored for use again.
        if (! getContextRelative() && ! FileUtils.isAbsoluteURI(path)) {
            assert path.startsWith("/") : path;
            setPath(relativeTo + path);
            setContextRelative(true);
            _outsidePageFlowDirectory = true;
        }
        
        // Store a flag in the request that will prevent another page flow from being initialized implicitly because
        // we're hitting a path within it.  We want to stay in the context of the current page flow.
        if (_outsidePageFlowDirectory) {
            PageFlowRequestWrapper.get(request).setStayInCurrentModule(true);
        }
    }
496250
def relative_path(self, key):
    ''''''
    key = str(key)                # stringify
    key = key.replace(':', '/')   # turn namespace delimiters into slashes
    key = key[1:]                 # remove first slash (absolute)
    if not self.case_sensitive:
      key = key.lower()           # coerce to lowercase
    return os.path.normpath(key)
72033
def get_temporary_link(path)
      resp = request('/files/get_temporary_link', path: path)
      return FileMetadata.new(resp['metadata']), resp['link']
    end
36510
def set_base_url(redis)
      if redis.get("base_url").nil?
        unless !defined?(content.redirect_through) || content.redirect_through.empty? || !@options[:first_page_redirect_internal]
          uri = Addressable::URI.parse(content.redirect_through.last)
          redis.sadd("internal_urls", [uri.scheme, "://", uri.host, "/*"].join)
        end
        redis.set("base_url", content.url)
      end
    end
341919
function getRedirectTo(options, page) {
    if( typeof options === 'string' ) {
        options = {redirectTo: options};
    }
    options = options || {};
    page = page || 'root';
    return options.redirectTo || defaults[page];
}
1367288
function metapath(filepath) {
    return path.join(path.dirname(filepath), '.' + path.basename(filepath));
}
395519
private function followRedirectPath()
    {
        $this->redirectsFollowed++;

        if ($this->getStatus() == 301 || $this->getStatus() == 302) {
            if ($this->redirectsFollowed < $this->maxRedirects) {
                $location = $this->getHeader('Location');
                $forwardTo = parse_url($location);

                if (isset($forwardTo['scheme']) && isset($forwardTo['host'])) {
                    $url = $location;
                } else {
                    $forwardFrom = parse_url(curl_getinfo($this->curl, CURLINFO_EFFECTIVE_URL));
                    $url = $forwardFrom['scheme'] . '://' . $forwardFrom['host'] . $location;
                }

                $this->get($url);
            } else {
                $errorString = "Too many redirects when trying to follow location.";
                throw new NetworkError($errorString, CURLE_TOO_MANY_REDIRECTS);
            }
        } else {
            $this->redirectsFollowed = 0;
        }
    }
1143564
def run_metadata_route(self, request):
    """"""
    tag = request.args.get('tag')
    run = request.args.get('run')
    if tag is None:
      return http_util.Respond(
          request, 'query parameter "tag" is required', 'text/plain', 400)
    if run is None:
      return http_util.Respond(
          request, 'query parameter "run" is required', 'text/plain', 400)
    result = self.run_metadata_impl(run, tag)
    if result is not None:
      (body, mime_type) = result  # pylint: disable=unpacking-non-sequence
      return http_util.Respond(request, body, mime_type)
    else:
      return http_util.Respond(request, '404 Not Found', 'text/plain',
                               code=404)
1251679
function relative(path, cb) {
    var value = path;
    for (var i = 0, ln = page.length; i < ln; i += 1) {
      if (page.charAt(i) === '/') {
        value = '../' + value;
      }
    }
    cb(value);
  }
959794
static function setRedirectData(M $m, $url, array $p = [], $forceGet = false) {$m->iiaSet(
		self::$REDIRECT_DATA, ['forceGet' => $forceGet, 'p' => $p, 'url' => $url]
	);}