• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.net.apihelpers;
6 
7 /** Utility class for standard {@link RedirectHandler} implementations. * */
8 public class RedirectHandlers {
9     /** Returns a redirect handler that never follows redirects. */
neverFollow()10     public static RedirectHandler neverFollow() {
11         return (info, newLocationUrl) -> false;
12     }
13 
14     /**
15      * Returns a redirect handler that always follows redirects.
16      *
17      * <p>Note that the maximum number of redirects to follow is still limited internally to prevent
18      * infinite looping.
19      */
alwaysFollow()20     public static RedirectHandler alwaysFollow() {
21         return (info, newLocationUrl) -> true;
22     }
23 
RedirectHandlers()24     private RedirectHandlers() {}
25 }
26