Build the appropriate redirection action for a location.

@param context the web context
@param location the location
@return the appropriate redirection action
509988
public static RedirectionAction buildRedirectUrlAction(final WebContext context, final String location) {
        if (ContextHelper.isPost(context) && useModernHttpCodes) {
            return new SeeOtherAction(location);
        } else {
            return new FoundAction(location);
        }
    }
1345893
public static function redirect($location, $permanent = false)
    {
        $response = new self(
            $permanent ? Status::MOVED_PERMANENTLY : Status::SEE_OTHER,
            new StringStream('')
        );
        $response->setHeader('Location', $location);
        return $response;
    }
938843
protected void success(PMStrutsContext ctx, String url, boolean redirect) throws PMForwardException {
        if (ctx.getOperation() != null && ctx.getOperation().getFollows() != null) {
            final String plainUrl = PMTags.plainUrl(
                    ctx.getPmsession(),
                    "/" + ctx.getOperation().getFollows() + ".do?pmid=" + ctx.getEntity().getId()).substring(getContextPath().length());
            throw new PMForwardException(new ActionRedirect(plainUrl));
        } else {
            final String plainUrl = PMTags.plainUrl(ctx.getPmsession(), url).substring(getContextPath().length());
            if (redirect) {
                throw new PMForwardException(new ActionRedirect(plainUrl));
            } else {
                throw new PMForwardException(new ActionForward(plainUrl));
            }
        }
    }
10052
public Result redirectTemporary(String url) {
        status(Status.TEMPORARY_REDIRECT);
        with(HeaderNames.LOCATION, url);
        return this;
    }
1170189
@Override
	public void findLocation(final String location) {
		showAlternativesView(false);
		GwtCommand command = new GwtCommand(GetLocationForStringRequest.COMMAND);
		GetLocationForStringRequest request = new GetLocationForStringRequest();
		request.setCrs(mapPresenter.getViewPort().getCrs());
		request.setLocation(location);
		request.setServicePattern(servicePattern);
		command.setCommandRequest(request);
		GeomajasServerExtension.getInstance().getCommandService().execute(command,
				new AbstractCommandCallback<GetLocationForStringResponse>() {
			public void execute(GetLocationForStringResponse response) {
				goToLocation(response, location);
			}
		});
	}
254030
public static void putUnauthorizedRedirectUrlIntoFlowScope(final RequestContext context, final URI url) {
        context.getFlowScope().put(PARAMETER_UNAUTHORIZED_REDIRECT_URL, url);
    }
238597
public function redirect($location, $isPermanently = false)
    {
        if ($isPermanently) {
            header('Location: ' . $location, false, 301);
            exit;
        } else {
            header('Location: ' . $location, false, 302);
            exit;
        }
    }
684884
public Actions contextClick(WebElement target) {
    if (isBuildingActions()) {
      action.addAction(new ContextClickAction(jsonMouse, (Locatable) target));
    }
    return moveInTicks(target, 0, 0).clickInTicks(RIGHT);
  }
610982
protected boolean routingToAction(HttpServletRequest request, HttpServletResponse response, String contextPath, String requestPath,
            String actionName, String paramPath, ActionExecute execByParam) throws IOException, ServletException {
        if (execByParam != null) { // already found
            processAction(request, response, execByParam, paramPath); // #to_action
            return true;
        }
        final OptionalThing<ActionExecute> found = LaActionExecuteUtil.findActionExecute(actionName, request);
        if (found.isPresent()) { // not use lambda because of throws definition
            final ActionExecute execute = found.get();
            if (needsTrailingSlashRedirect(request, requestPath, execute)) { // index() or by request parameter
                redirectWithTrailingSlash(request, response, contextPath, requestPath);
            } else {
                processAction(request, response, execute, null); // #to_action
            }
            return true;
        } else { // e.g. not found index()
            return false;
        }
    }
89784
protected function redirect($location, $status = 302, $headers = array()) {
		// Check if a output action has be already performed
		$this->_checkIfPerformed();

		// Create a redirect
		$redirectResponse = \Symfony\Component\HttpFoundation\RedirectResponse::create($location, $status, $headers);

		// Add request informationen
		$redirectResponse->prepare($this->application->requestStack->getCurrentRequest());

		// Replace response object
		$this->application->response = $redirectResponse;

		// Don't use a template
		$this->useTemplate(false, $status);
	}
1193362
@Override
    public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
        URI uri = this.redirectStrategy.getLocationURI(request, response, context);

        String resultingPageUrl = uri.toString();

        DriverRequest driverRequest = ((OutgoingRequest) request).getOriginalRequest();

        // Remove context if present
        if (StringUtils.startsWith(resultingPageUrl, driverRequest.getVisibleBaseUrl())) {
            resultingPageUrl =
                    "/"
                            + StringUtils.stripStart(
                                    StringUtils.replace(resultingPageUrl, driverRequest.getVisibleBaseUrl(), ""), "/");
        }
        resultingPageUrl = ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false);

        return UriUtils.createURI(ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false));
    }
775258
public function redirect($location, $status = 302)
    {
        if (!$location) {
            return;
        }
        $this->status($status);
        $headers = $this->headers();
        $headers['Location'] = $location;
        return $this;
    }
523955
public static function redirectTo(string $location, array $queryParameters = null): void
    {
        if (isset($queryParameters)) {
            header("Location: $location" . "?" . http_build_query($queryParameters));
        } else {
            header("Location: $location");
        }
        exit();
    }
879262
public boolean handleWelcomeRedirect( FileRequestContext context ) throws IOException {
    if( context.file.isFile() && context.file.getName().equals("index.html")) {
      resolveContentType(context);
      String location = context.path.replaceFirst("/index.html\\Z", "");
      if( location.isEmpty() ) location = "/";
      if( context.request.getQueryString() != null ) location = location + "?" + context.request.getQueryString();
      sendPermanentRedirect(context, location);
      return true;
    }
    return false;
  }
900796
public static GeoLocationRequest getHttpServletRequestGeoLocationFromRequestContext(final RequestContext context) {
        val servletRequest = getHttpServletRequestFromExternalWebflowContext(context);
        return getHttpServletRequestGeoLocation(servletRequest);
    }
874322
public function redirect($url, $statusCode = 302)
    {
        $context = Context::getInstance();

        header(HTTPToolkit::statusCodeHeader($statusCode));
        header(HTTPToolkit::locationHeader($url));

        throw new InterruptedActionException(
            'Interrupted action after a redirection',
            $context->getModuleName(),
            $context->getActionName()
        );
    }
921151
public static Filter getFilterForLocation(String location, String context) throws IllegalArgumentException {
        String filter = makeLocationFilterString(location, context);
        try {
            return FrameworkUtil.createFilter(filter);
        } catch (InvalidSyntaxException e) {
            throw new IllegalArgumentException("location is invalid: " + location, e);
        }
    }