Module methanol

Interface Methanol.Interceptor

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  Methanol.Interceptor.Chain<T>
      An object that gives interceptors the ability to relay requests to sibling interceptors, till eventually being sent by the client's backend.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static Methanol.Interceptor create​(java.util.function.Function<java.net.http.HttpRequest,​java.net.http.HttpRequest> operator)
      Returns an interceptor that forwards the request after applying the given operator.
      <T> java.net.http.HttpResponse<T> intercept​(java.net.http.HttpRequest request, Methanol.Interceptor.Chain<T> chain)
      Intercepts given request and returns the resulting response, usually by forwarding to the given chain.
      <T> java.util.concurrent.CompletableFuture<java.net.http.HttpResponse<T>> interceptAsync​(java.net.http.HttpRequest request, Methanol.Interceptor.Chain<T> chain)
      Intercepts the given request and returns a CompletableFuture for the resulting response, usually by forwarding to the given chain.
    • Method Detail

      • intercept

        <T> java.net.http.HttpResponse<T> intercept​(java.net.http.HttpRequest request,
                                                    Methanol.Interceptor.Chain<T> chain)
                                             throws java.io.IOException,
                                                    java.lang.InterruptedException
        Intercepts given request and returns the resulting response, usually by forwarding to the given chain.
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • interceptAsync

        <T> java.util.concurrent.CompletableFuture<java.net.http.HttpResponse<T>> interceptAsync​(java.net.http.HttpRequest request,
                                                                                                 Methanol.Interceptor.Chain<T> chain)
        Intercepts the given request and returns a CompletableFuture for the resulting response, usually by forwarding to the given chain.
      • create

        static Methanol.Interceptor create​(java.util.function.Function<java.net.http.HttpRequest,​java.net.http.HttpRequest> operator)
        Returns an interceptor that forwards the request after applying the given operator.