Computes the redirection target URL for the newly created {@link TopLevelItem}.
181734
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException {
        return req.getContextPath()+'/'+result.getUrl()+"configure";
    }
1312903
private static HttpHost determineTarget(HttpUriRequest request) throws ClientProtocolException {
		// A null target may be acceptable if there is a default target.
		// Otherwise, the null target is detected in the director.
		HttpHost target = null;
		URI requestURI = request.getURI();
		if (requestURI.isAbsolute()) {
			target = URIUtils.extractHost(requestURI);
			if (target == null) {
				throw new ClientProtocolException(
						"URI does not specify a valid host name: " + requestURI);
			}
		}
		return target;
	}
760982
private void handleRequestRedirect(
            final CrawlCandidate currentCrawlCandidate,
            final String redirectedUrl) {
        CrawlRequestBuilder builder = new CrawlRequestBuilder(redirectedUrl)
                .setPriority(currentCrawlCandidate.getPriority());
        currentCrawlCandidate.getMetadata().ifPresent(builder::setMetadata);
        CrawlRequest redirectedRequest = builder.build();

        crawlFrontier.feedRequest(redirectedRequest, false);
        callbackManager.call(CrawlEvent.REQUEST_REDIRECT,
                new RequestRedirectEvent(currentCrawlCandidate, redirectedRequest));
    }
428536
protected function initialRedirectUrl() {

        $defaultUrl = '/'. $this->controller->id . '/' . $this->controller->defaultAction;

        if (isset($this->controller->module->id) && !$this->controller->module instanceof Application) {
            $defaultUrl = '/' . $this->controller->module->id . $defaultUrl;
        }

        if ( empty( $this->successUrl ) ) {
            $this->successUrl = $defaultUrl;
        }

        if ( empty( $this->failedUrl ) ) {
            $this->failedUrl = $defaultUrl;
        }

    }
1184088
function addRedirectRoute(server, scaffold) {
        assert(scaffold.path && scaffold.target, `TransomScaffold redirectRoute requires 'path' and 'target' to be specified.`);

        server.get(scaffold.path, function (req, res, next) {
            res.redirect(scaffold.target, next);
        });
    }
1040278
public static function redirect(string $source_url, string $redirection_url, int $status_code=301)  {
		// create a new route
		$route = new Route();
		// add it to the list of known routes
		self::$_routes[$route->name] = $route
			->setUrl($source_url)
			->setRedirect($redirection_url, $status_code);
		// return the route for finer tuning
		return self::$_routes[$route->name];
	}
726690
private URL getRedirectURL(String location) throws IOException {
        HttpInputStream in = get(location, false, false);
        try {
            if (in.getStatusCode() == 302) {
                Header h = in.getResponseHeader("location");
                if (h != null) {
                    return new URL(h.getValue());
                }
            }
            return null;
        } finally {
            try {
                in.close();
            } catch (Exception e) {
            }
        }
    }
52681
@RequestMapping(value = "api/edit/server/{id}/dest", method = RequestMethod.POST)
    public
    @ResponseBody
    ServerRedirect updateDestRedirectUrl(Model model, @PathVariable int id, String destUrl) throws Exception {
        ServerRedirectService.getInstance().setDestinationUrl(destUrl, id);
        return ServerRedirectService.getInstance().getRedirect(id);
    }
289272
@Bean
    public Redirector redirector() {
        final Redirector redirector = new Redirector();
        redirector.setApplicationContextPath(hawtioPath);
        return redirector;
    }
3905
protected function _storeTargetUrl() {
        $request = $this->getRequest();
        // Only store targetUrl when method = GET. A redirect to a POST request is useless.
        if (!$request->isGet()) {
            return;
        }

        // Allow ?targetUrl=/path/to/elsewhere on any URL
        if (!$targetUrl = $request->getParam('targetUrl')) {
            $targetUrl = $request->getRequestUri();
            $baseUrl = $request->getBaseUrl();
            /**
             * Remove the baseUrl from the targetUrl. This is neccessary
             * when Garp is installed in a subfolder.
             */
            $targetUrl = Garp_Util_String::strReplaceOnce($baseUrl, '', $targetUrl);
        }

        if ($targetUrl !== '/favicon.ico' && !$request->isXmlHttpRequest()) {
            $store = Garp_Auth::getInstance()->getStore();
            $store->targetUrl = $targetUrl;
        }
    }
328342
def get_redirect_target():
    """"""
    for target in request.values.get('next'), request.referrer:
        if target and is_local_url(target):
            return target
1278158
function getRedirectRoute(that, path, newRoutePath, newRoutes, routeDivergenceIndex) {
        if(newRoutes.length > 0) {
            var redirectInfo = newRoutes[newRoutes.length-1].route.redirectInfo
        } else {
            var redirectInfo = newRoutePath[routeDivergenceIndex-1].route.redirectInfo
        }

        if(redirectInfo !== undefined) {
            var newPathToEmit = redirectInfo.path
            if(redirectInfo.emitOldPath)
                newPathToEmit = path

            try {
                var newPath = getPathFromInput(that.transform, redirectInfo.path)
            } catch(e) {
                if(e.message === 'pathNotArray') {
                    throw new Error("A route passed to `redirect` must be an array")
                } else {
                    throw e
                }
            }

            return getNewRouteInfo(that, newRoutePath, newPath, newPathToEmit)
        }

        return false
    }
499361
@RequestMapping(value = "api/edit/server", method = RequestMethod.POST)
    public
    @ResponseBody
    ServerRedirect addRedirectToProfile(Model model,
                                        @RequestParam(value = "profileId", required = false) Integer profileId,
                                        @RequestParam(value = "profileIdentifier", required = false) String profileIdentifier,
                                        @RequestParam(value = "srcUrl", required = true) String srcUrl,
                                        @RequestParam(value = "destUrl", required = true) String destUrl,
                                        @RequestParam(value = "clientUUID", required = true) String clientUUID,
                                        @RequestParam(value = "hostHeader", required = false) String hostHeader) throws Exception {
        if (profileId == null && profileIdentifier == null) {
            throw new Exception("profileId required");
        }
        if (profileId == null) {
            profileId = ProfileService.getInstance().getIdFromName(profileIdentifier);
        }

        int clientId = ClientService.getInstance().findClient(clientUUID, profileId).getId();

        int redirectId = ServerRedirectService.getInstance().addServerRedirectToProfile("", srcUrl, destUrl, hostHeader,
                profileId, clientId);
        return ServerRedirectService.getInstance().getRedirect(redirectId);
    }
580238
private Page getTargetPage(String targetPath, InternalLinkResolverOptions options) {

    if (StringUtils.isEmpty(targetPath)) {
      return null;
    }

    // Rewrite target to current site context
    String rewrittenPath;
    if (options.isRewritePathToContext() && !useTargetContext(options)) {
      rewrittenPath = urlHandler.rewritePathToContext(SyntheticNavigatableResource.get(targetPath, resourceResolver));
    }
    else {
      rewrittenPath = targetPath;
    }
    if (StringUtils.isEmpty(rewrittenPath)) {
      return null;
    }

    // Get target page referenced by target path and check for acceptance
    Page targetPage = pageManager.getPage(rewrittenPath);
    if (acceptPage(targetPage, options)) {
      return targetPage;
    }
    else {
      return null;
    }
  }
326255
public String getRedirectUrlFromServerToClient(String clientId, String contextPath, String redirectToRPHostAndPort) {
        String redirectURL = null;
        if (redirectToRPHostAndPort != null && redirectToRPHostAndPort.length() > 0) {
            try {
                final String fHostPort = redirectToRPHostAndPort;
                @SuppressWarnings({ "unchecked", "rawtypes" })
                URL url = (URL) java.security.AccessController.doPrivileged(new java.security.PrivilegedExceptionAction() {
                    @Override
                    public Object run() throws Exception {
                        return new URL(fHostPort);
                    }
                });
                int port = url.getPort();
                String path = url.getPath();
                if (path == null)
                    path = "";
                if (path.endsWith("/")) {
                    path = path.substring(0, path.length() - 1);
                }
                String entryPoint = path + contextPath + "/redirect/" + clientId;
                redirectURL = url.getProtocol() + "://" + url.getHost() + (port > 0 ? ":" + port : "");

                redirectURL = redirectURL + (entryPoint.startsWith("/") ? "" : "/") + entryPoint;
            } catch (Exception e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "the value of redirectToRPHostAndPort might not valid. Please verify that the format is <protocol>://<host>:<port> " + redirectToRPHostAndPort
                            + "\n" + e.getMessage());
                }
            }
        }
        return redirectURL;
    }
161922
@Nullable
    public final Controller getTargetController() {
        if (targetInstanceId != null) {
            return router.getRootRouter().getControllerWithInstanceId(targetInstanceId);
        }
        return null;
    }
770702
function navigateToTarget( targetOrPlaceId, parameters, fragment, redirectFrom ) {
      const place = placeForTarget( targetOrPlaceId, redirectFrom );
      const options = {};
      if( redirectFrom ) {
         options.replaceHistory = true;
      }
      if( fragment ) {
         options.fragment = fragment;
      }
      router.navigateTo( place.patterns, withoutRedundantParameters( place, parameters ), options );
   }