Creates a crawl request for the redirected URL, feeds it to the crawler and calls the
appropriate event callback.

@param currentCrawlCandidate the current crawl candidate
@param redirectedUrl         the URL of the redirected request
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));
    }
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>");
	}
1217667
function crawlHref($,result, a, callback) {

      var link = $(a).attr('href');
      var parentUrl = result.url;
      if (link) {

        var anchor = $(a).text() ? $(a).text() : "";
        var noFollow = $(a).attr("rel");
        var isDoFollow =  ! (noFollow && noFollow === "nofollow");

        var linkUri = URI.linkToURI(parentUrl, link);

        pm.crawlLink(parentUrl, linkUri, anchor, isDoFollow, function(){
          addLinkToQueue(result, parentUrl, linkUri, anchor, isDoFollow, callback);
        });

      }
      else {
        callback();
      }

}
667932
public Result redirect(String url) {
        status(Status.SEE_OTHER);
        with(HeaderNames.LOCATION, url);
        return this;
    }
704437
@RequestMapping
    public void service(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);

        // create the redirect URL, adding fname and args parameters if necessary
        String redirectTarget = null;

        final String refUrl = request.getParameter(REFERER_URL_PARAM);
        final URL redirectLocation = parseLocalRefUrl(request, refUrl);
        if (redirectLocation != null) {
            redirectTarget = redirectLocation.toString();
        }

        if (redirectTarget == null) {
            /* Grab the target functional name, if any, off the login request.
             * Also any arguments for the target. We will pass them  along after authentication.
             */
            String targetFname = request.getParameter("uP_fname");

            if (targetFname == null) {
                final IPortalUrlBuilder defaultUrl = this.portalUrlProvider.getDefaultUrl(request);
                redirectTarget = defaultUrl.getUrlString();
            } else {
                try {
                    final IPortalUrlBuilder urlBuilder =
                            this.portalUrlProvider.getPortalUrlBuilderByPortletFName(
                                    request, targetFname, UrlType.RENDER);

                    Enumeration<String> e = request.getParameterNames();
                    while (e.hasMoreElements()) {
                        String paramName = e.nextElement();
                        if (!paramName.equals("uP_fname")) {
                            urlBuilder.addParameter(
                                    paramName, request.getParameterValues(paramName));
                        }
                    }

                    redirectTarget = urlBuilder.getUrlString();
                } catch (IllegalArgumentException e) {
                    final IPortalUrlBuilder defaultUrl =
                            this.portalUrlProvider.getDefaultUrl(request);
                    redirectTarget = defaultUrl.getUrlString();
                }
            }
        }

        IPerson person = null;

        final Object authError =
                request.getSession(false).getAttribute(LoginController.AUTH_ERROR_KEY);
        if (authError == null || !((Boolean) authError)) {
            person = this.personManager.getPerson(request);
        }

        if (person == null || !person.getSecurityContext().isAuthenticated()) {
            if (request.getMethod().equals("POST"))
                request.getSession(false).setAttribute(AUTH_ATTEMPTED_KEY, "true");
            // Preserve the attempted username so it can be redisplayed to the user
            String attemptedUserName = request.getParameter("userName");
            if (attemptedUserName != null)
                request.getSession(false)
                        .setAttribute(ATTEMPTED_USERNAME_KEY, request.getParameter("userName"));
        }

        final String encodedRedirectURL = response.encodeRedirectURL(redirectTarget);

        if (log.isDebugEnabled()) {
            log.debug("Redirecting to " + redirectTarget);
        }

        response.sendRedirect(encodedRedirectURL);
    }
617670
public void redirect(String url) throws IOException {
        endChangesIfNecessary();
        ResponseWriter writer = getWrapped();
        writer.startElement("redirect", null);
        writer.writeAttribute("url", url, null);
        writer.endElement("redirect");
    }
1294971
public static void updateDirectEditFlagInSession(ServletRequest request) {

        String disabledParam = request.getParameter(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT);
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(disabledParam)) {
            if (Boolean.parseBoolean(disabledParam)) {
                ((HttpServletRequest)request).getSession().setAttribute(
                    CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT,
                    Boolean.TRUE);
                String buttonLeft = request.getParameter(CmsGwtConstants.PARAM_BUTTON_LEFT);
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(buttonLeft)) {
                    Integer left = null;
                    try {
                        left = Integer.valueOf(buttonLeft);
                        if (left.intValue() > 0) {
                            ((HttpServletRequest)request).getSession().setAttribute(
                                CmsGwtConstants.PARAM_BUTTON_LEFT,
                                left);
                        }
                    } catch (NumberFormatException e) {
                        // malformed parameter, ignore
                    }
                }
            } else {
                ((HttpServletRequest)request).getSession().removeAttribute(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT);
            }
        }
    }
579292
public function handleRedirect(RedirectEvent $event)
    {
        /** @var Controller $controllerAdapter */
        $controllerAdapter = $this->framework->getAdapter(Controller::class);

        $controllerAdapter->redirect($event->getNewLocation(), $event->getStatusCode());
    }
9535
private String getRedirectUrl(HttpServletRequest request, String newScheme) {
    String serverName = request.getServerName();
    String uri = request.getRequestURI();

    StringBuilder redirect = new StringBuilder(100);
    redirect.append(newScheme);
    redirect.append("://");
    redirect.append(serverName);
    redirect.append(uri);

    String query = request.getQueryString();
    if (query != null) {
      redirect.append('?');
      redirect.append(query);
    }

    return redirect.toString();
  }
780258
public RequestBuilder put(final String url) {

    checkNotNull(url, "url may not be null");
    final AsyncHttpClient.BoundRequestBuilder ningRequestBuilder = asyncHttpClient.preparePut(url);
    return createNewRequestBuilder(url, ningRequestBuilder);
  }
1320132
def _request(self, resource, rtype, action=None, payload=None, offset=None, limit=None, requestId=None,
                 is_crud=False):
        
        end = self.__end
        if end.is_set():
            raise LinkShutdownException('Client stopped')

        rng = None
        if offset is not None and limit is not None:
            Validation.limit_offset_check(limit, offset)
            rng = "%d/%d" % (offset, limit)
        with self.__requests:
            if requestId is None:
                requestId = self.__new_request_id()
            elif requestId in self.__requests:
                raise ValueError('requestId %s already in use' % requestId)
            inner_msg = self.__make_innermsg(resource, rtype, requestId, action, payload, rng)
            self.__requests[requestId] = ret = RequestEvent(requestId, inner_msg, is_crud=is_crud)
        #
        if not self.__retry_enqueue(PreparedMessage(inner_msg, requestId)):
            raise LinkShutdownException('Client stopping')
        return ret
109315
protected HttpBuilder redirect(URL url) {
        RedirectResponse resp = new RedirectResponse(url);
        RequestContext.setControllerResponse(resp);
        return new HttpBuilder(resp);
    }
306050
protected function _appendRedirectQueryString($url, $redirectQueryString)
    {
        if (!$redirectQueryString) {
            return $url;
        }

        if (is_array($url)) {
            $url['?'][static::QUERY_STRING_REDIRECT] = $redirectQueryString;
        } else {
            $char = strpos($url, '?') === false ? '?' : '&';
            $url .= $char . static::QUERY_STRING_REDIRECT . '=' . urlencode($redirectQueryString);
        }

        return $url;
    }
1204797
function Request_redirect(url, isTemp) {
        logger.info('Request.redirect:', {
            url: url,
            isTemp: isTemp
        });
        this.addHeader('Location', url);
        this.stopPromiseChain();
        this.isRendered = true;
        if (Type.isBoolean(isTemp) && !!isTemp) {
            this.response.writeHead(302, this.headers);
        } else {
            this.response.writeHead(301, this.headers);
        }
        this.response.end('Redirect to:' + url);
    }
775540
function (url) {
		var current = this.current, params = current.params;

		var state = find(url);

		if (state.is_changed(current.name, params)) {
			this.current = state;
			this.trigger_event("state_changed", state);
			this.trigger_event("state_changed_success", url);
		}
	}
672960
private void run() {
        onStart();

        while (!isStopping && crawlFrontier.hasNextCandidate()) {
            CrawlCandidate currentCandidate = crawlFrontier.getNextCandidate();
            String candidateUrl = currentCandidate.getRequestUrl().toString();
            HttpClientContext context = HttpClientContext.create();
            CloseableHttpResponse httpHeadResponse = null;
            boolean isUnsuccessfulRequest = false;

            try {
                // Send an HTTP HEAD request to determine its availability and content type
                httpHeadResponse = getHttpHeadResponse(candidateUrl, context);
            } catch (IOException exception) {
                callbackManager.call(CrawlEvent.REQUEST_ERROR,
                        new RequestErrorEvent(currentCandidate, exception));
                isUnsuccessfulRequest = true;
            }

            if (!isUnsuccessfulRequest) {
                String responseUrl = getFinalResponseUrl(context, candidateUrl);
                if (responseUrl.equals(candidateUrl)) {
                    String responseMimeType = getResponseMimeType(httpHeadResponse);
                    if (responseMimeType.equals(ContentType.TEXT_HTML.getMimeType())) {
                        boolean isTimedOut = false;
                        TimeoutException timeoutException = null;

                        try {
                            // Open URL in browser
                            webDriver.get(candidateUrl);
                        } catch (TimeoutException exception) {
                            isTimedOut = true;
                            timeoutException = exception;
                        }

                        // Ensure the HTTP client and Selenium have the same state
                        syncHttpClientCookies();

                        if (isTimedOut) {
                            callbackManager.call(CrawlEvent.PAGE_LOAD_TIMEOUT,
                                    new PageLoadTimeoutEvent(currentCandidate, timeoutException));
                        } else {
                            String loadedPageUrl = webDriver.getCurrentUrl();
                            if (!loadedPageUrl.equals(candidateUrl)) {
                                // Create a new crawl request for the redirected URL (JS redirect)
                                handleRequestRedirect(currentCandidate, loadedPageUrl);
                            } else {
                                callbackManager.call(CrawlEvent.PAGE_LOAD,
                                        new PageLoadEvent(currentCandidate, webDriver));
                            }
                        }
                    } else {
                        // URLs that point to non-HTML content should not be opened in the browser
                        callbackManager.call(CrawlEvent.NON_HTML_CONTENT,
                                new NonHtmlContentEvent(currentCandidate, responseMimeType));
                    }
                } else {
                    // Create a new crawl request for the redirected URL
                    handleRequestRedirect(currentCandidate, responseUrl);
                }
            }

            HttpClientUtils.closeQuietly(httpHeadResponse);
            performDelay();
        }

        onStop();
    }
898682
@Override
	public void handleRequest(final Request request) {
		// Check if this link was the AJAX Trigger
		AjaxOperation operation = AjaxHelper.getCurrentOperation();
		boolean pressed = (operation != null && getId().equals(operation.getTriggerId()));

		// Protect against client-side tampering of disabled/read-only fields.
		if (isDisabled() && pressed) {
			LOG.warn("A disabled link has been triggered. " + getText() + ". " + getId());
			return;
		}

		// If an action has been supplied then execute it, but only after
		// handle request has been performed on the entire component tree.
		final Action action = getAction();

		if (pressed && action != null) {
			final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject());

			Runnable later = new Runnable() {
				@Override
				public void run() {
					action.execute(event);
				}
			};

			invokeLater(later);
		}
	}