Interface ApolloInterceptor

  • All Known Implementing Classes:
    ApolloAutoPersistedOperationInterceptor, ApolloCacheInterceptor, ApolloParseInterceptor

    public interface ApolloInterceptor
    ApolloInterceptor is responsible for observing and modifying the requests going out and the corresponding responses coming back in. Typical responsibilities include adding or removing headers from the request or response objects, transforming the returned responses from one type to another, etc.
    • Method Detail

      • interceptAsync

        void interceptAsync​(@NotNull
                            ApolloInterceptor.InterceptorRequest request,
                            @NotNull
                            ApolloInterceptorChain chain,
                            @NotNull
                            java.util.concurrent.Executor dispatcher,
                            @NotNull
                            ApolloInterceptor.CallBack callBack)
        Intercepts the outgoing request and performs non blocking operations on the request or the response returned by the next set of interceptors in the chain.
        Parameters:
        request - outgoing request object.
        chain - the ApolloInterceptorChain object containing the next set of interceptors.
        dispatcher - the Executor which dispatches the non blocking operations on the request/response.
        callBack - the Callback which will handle the interceptor's response or failure exception.
      • dispose

        void dispose()
        Disposes of the resources which are no longer required.

        A use case for this method call would be when an ApolloCall needs to be cancelled and resources need to be disposed of.