Class RedirectHandlerOption

java.lang.Object
com.microsoft.kiota.http.middleware.options.RedirectHandlerOption
All Implemented Interfaces:
com.microsoft.kiota.RequestOption

public class RedirectHandlerOption extends Object implements com.microsoft.kiota.RequestOption
Options to be passed to the redirect middleware.
  • Field Details

    • DEFAULT_MAX_REDIRECTS

      public static final int DEFAULT_MAX_REDIRECTS
      The default maximum number of redirects to follow
      See Also:
    • MAX_REDIRECTS

      public static final int MAX_REDIRECTS
      The absolute maximum number of redirects that can be followed
      See Also:
    • DEFAULT_SHOULD_REDIRECT

      @Nonnull public static final IShouldRedirect DEFAULT_SHOULD_REDIRECT
      Default redirect evaluation, always follow redirect information.
    • DEFAULT_SCRUB_SENSITIVE_HEADERS

      @Nonnull public static final RedirectHandlerOption.IScrubSensitiveHeaders DEFAULT_SCRUB_SENSITIVE_HEADERS
      The default implementation for scrubbing sensitive headers during redirects. This method removes Authorization and Cookie headers when the host, scheme, or port changes, and removes Proxy-Authorization headers when no proxy is configured or the proxy is bypassed for the new URL.
  • Constructor Details

    • RedirectHandlerOption

      public RedirectHandlerOption()
      Create default instance of redirect options, with default values of max redirects and should redirect
    • RedirectHandlerOption

      public RedirectHandlerOption(int maxRedirects, @Nullable IShouldRedirect shouldRedirect)
      Create an instance with provided values
      Parameters:
      maxRedirects - Max redirects to occur
      shouldRedirect - Should redirect callback called before every redirect
    • RedirectHandlerOption

      public RedirectHandlerOption(int maxRedirects, @Nullable IShouldRedirect shouldRedirect, @Nullable RedirectHandlerOption.IScrubSensitiveHeaders scrubSensitiveHeaders)
      Create an instance with provided values
      Parameters:
      maxRedirects - Max redirects to occur
      shouldRedirect - Should redirect callback called before every redirect
      scrubSensitiveHeaders - Callback to scrub sensitive headers during redirects
  • Method Details

    • maxRedirects

      public int maxRedirects()
      Gets the maximum number of redirects to follow.
      Returns:
      max redirects
    • shouldRedirect

      @Nonnull public IShouldRedirect shouldRedirect()
      Gets the callback evaluating whether a redirect should be followed.
      Returns:
      should redirect
    • scrubSensitiveHeaders

      @Nonnull public RedirectHandlerOption.IScrubSensitiveHeaders scrubSensitiveHeaders()
      Gets the callback for scrubbing sensitive headers during redirects.
      Returns:
      scrub sensitive headers callback
    • getProxyResolver

      @Nullable public static Function<okhttp3.HttpUrl,Proxy> getProxyResolver(@Nullable ProxySelector proxySelector)
      Helper method to get a proxy resolver from a ProxySelector.
      Parameters:
      proxySelector - The ProxySelector to use, or null if no proxy is configured
      Returns:
      A function that resolves proxies for a given HttpUrl, or null if no proxy selector is provided
    • getType

      @Nonnull public <T extends com.microsoft.kiota.RequestOption> Class<T> getType()
      Specified by:
      getType in interface com.microsoft.kiota.RequestOption