Class RedirectHandlerOption
java.lang.Object
com.microsoft.kiota.http.middleware.options.RedirectHandlerOption
- All Implemented Interfaces:
com.microsoft.kiota.RequestOption
Options to be passed to the redirect middleware.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for scrubbing sensitive headers during redirects. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default maximum number of redirects to followstatic final RedirectHandlerOption.IScrubSensitiveHeadersThe default implementation for scrubbing sensitive headers during redirects.static final IShouldRedirectDefault redirect evaluation, always follow redirect information.static final intThe absolute maximum number of redirects that can be followed -
Constructor Summary
ConstructorsConstructorDescriptionCreate default instance of redirect options, with default values of max redirects and should redirectRedirectHandlerOption(int maxRedirects, IShouldRedirect shouldRedirect) Create an instance with provided valuesRedirectHandlerOption(int maxRedirects, IShouldRedirect shouldRedirect, RedirectHandlerOption.IScrubSensitiveHeaders scrubSensitiveHeaders) Create an instance with provided values -
Method Summary
Modifier and TypeMethodDescriptiongetProxyResolver(ProxySelector proxySelector) Helper method to get a proxy resolver from a ProxySelector.<T extends com.microsoft.kiota.RequestOption>
Class<T> getType()intGets the maximum number of redirects to follow.Gets the callback for scrubbing sensitive headers during redirects.Gets the callback evaluating whether a redirect should be followed.
-
Field Details
-
DEFAULT_MAX_REDIRECTS
public static final int DEFAULT_MAX_REDIRECTSThe default maximum number of redirects to follow- See Also:
-
MAX_REDIRECTS
public static final int MAX_REDIRECTSThe absolute maximum number of redirects that can be followed- See Also:
-
DEFAULT_SHOULD_REDIRECT
Default redirect evaluation, always follow redirect information. -
DEFAULT_SCRUB_SENSITIVE_HEADERS
@Nonnull public static final RedirectHandlerOption.IScrubSensitiveHeaders DEFAULT_SCRUB_SENSITIVE_HEADERSThe 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
Create an instance with provided values- Parameters:
maxRedirects- Max redirects to occurshouldRedirect- 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 occurshouldRedirect- Should redirect callback called before every redirectscrubSensitiveHeaders- 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
Gets the callback evaluating whether a redirect should be followed.- Returns:
- should redirect
-
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
- Specified by:
getTypein interfacecom.microsoft.kiota.RequestOption
-