Class UrlReplaceHandler

java.lang.Object
com.microsoft.kiota.http.middleware.UrlReplaceHandler
All Implemented Interfaces:
okhttp3.Interceptor

public class UrlReplaceHandler extends Object implements okhttp3.Interceptor
A middleware to replace the url with the specified replacement pairs.
  • Constructor Details

    • UrlReplaceHandler

      public UrlReplaceHandler()
      Instantiate a UrlReplaceHandler with default UrlReplaceHandlerOption.
    • UrlReplaceHandler

      public UrlReplaceHandler(@Nonnull UrlReplaceHandlerOption urlReplaceHandlerOption)
      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:
      intercept in interface okhttp3.Interceptor
      Throws:
      IOException
    • getUrlReplaceHandlerOption

      @Nonnull public UrlReplaceHandlerOption getUrlReplaceHandlerOption()
      Gets the UrlReplaceHandlerOption for the UrlReplaceHandler.
      Returns:
      the UrlReplaceHandlerOption for the UrlReplaceHandler.
    • setUrlReplaceHandlerOption

      public void setUrlReplaceHandlerOption(@Nonnull UrlReplaceHandlerOption urlReplaceHandlerOption)
      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.