Class UrlReplaceHandler
java.lang.Object
com.microsoft.kiota.http.middleware.UrlReplaceHandler
- All Implemented Interfaces:
okhttp3.Interceptor
A middleware to replace the url with the specified replacement pairs.
-
Nested Class Summary
Nested classes/interfaces inherited from interface okhttp3.Interceptor
okhttp3.Interceptor.Chain, okhttp3.Interceptor.Companion -
Field Summary
Fields inherited from interface okhttp3.Interceptor
Companion -
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a UrlReplaceHandler with default UrlReplaceHandlerOption.UrlReplaceHandler(UrlReplaceHandlerOption urlReplaceHandlerOption) Instantiate a UrlReplaceHandler with specified UrlReplaceHandlerOption -
Method Summary
Modifier and TypeMethodDescriptionGets the UrlReplaceHandlerOption for the UrlReplaceHandler.okhttp3.Responseintercept(okhttp3.Interceptor.Chain chain) static okhttp3.RequestreplaceRequestUrl(okhttp3.Request request, Map<String, String> replacementPairs) Replaces the url of the request using the replacement pairs provided.voidsetUrlReplaceHandlerOption(UrlReplaceHandlerOption urlReplaceHandlerOption) Sets the UrlReplaceHandlerOption for the UrlReplaceHandler.
-
Constructor Details
-
UrlReplaceHandler
public UrlReplaceHandler()Instantiate a UrlReplaceHandler with default UrlReplaceHandlerOption. -
UrlReplaceHandler
Instantiate a UrlReplaceHandler with specified UrlReplaceHandlerOption- Parameters:
urlReplaceHandlerOption- the specified UrlReplaceHandlerOption for the UrlReplaceHandler.
-
-
Method Details
-
intercept
@Nonnull public okhttp3.Response intercept(@Nonnull okhttp3.Interceptor.Chain chain) throws IOException - Specified by:
interceptin interfaceokhttp3.Interceptor- Throws:
IOException
-
getUrlReplaceHandlerOption
Gets the UrlReplaceHandlerOption for the UrlReplaceHandler.- Returns:
- the UrlReplaceHandlerOption for the UrlReplaceHandler.
-
setUrlReplaceHandlerOption
Sets the UrlReplaceHandlerOption for the UrlReplaceHandler.- Parameters:
urlReplaceHandlerOption- the UrlReplaceHandlerOption to set.
-
replaceRequestUrl
@Nonnull public static okhttp3.Request replaceRequestUrl(@Nonnull okhttp3.Request request, @Nonnull Map<String, String> replacementPairs) Replaces the url of the request using the replacement pairs provided.- Parameters:
request- the request to replace the url of.replacementPairs- the replacement pairs to use.- Returns:
- the request with the updated url.
-