public final class ApolloServerInterceptor extends java.lang.Object implements ApolloInterceptor
ApolloInterceptor
responsible for making the network calls to the
server. It is the last interceptor in the chain of interceptors and hence doesn't call
ApolloInterceptorChain#proceedAsync(InterceptorRequest, Executor, CallBack)
on the interceptor chain.ApolloInterceptor.CallBack, ApolloInterceptor.FetchSourceType, ApolloInterceptor.InterceptorRequest, ApolloInterceptor.InterceptorResponse
Constructor and Description |
---|
ApolloServerInterceptor(okhttp3.HttpUrl serverUrl,
okhttp3.Call.Factory httpCallFactory,
com.apollographql.apollo.api.cache.http.HttpCachePolicy.Policy cachePolicy,
boolean prefetch,
com.apollographql.apollo.response.ScalarTypeAdapters scalarTypeAdapters,
com.apollographql.apollo.internal.ApolloLogger logger) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of the resources which are no longer required.
|
void |
interceptAsync(ApolloInterceptor.InterceptorRequest request,
ApolloInterceptorChain chain,
java.util.concurrent.Executor dispatcher,
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.
|
public ApolloServerInterceptor(@NotNull okhttp3.HttpUrl serverUrl, @NotNull okhttp3.Call.Factory httpCallFactory, @Nullable com.apollographql.apollo.api.cache.http.HttpCachePolicy.Policy cachePolicy, boolean prefetch, @NotNull com.apollographql.apollo.response.ScalarTypeAdapters scalarTypeAdapters, @NotNull com.apollographql.apollo.internal.ApolloLogger logger)
public void interceptAsync(@NotNull ApolloInterceptor.InterceptorRequest request, @NotNull ApolloInterceptorChain chain, @NotNull java.util.concurrent.Executor dispatcher, @NotNull ApolloInterceptor.CallBack callBack)
ApolloInterceptor
interceptAsync
in interface ApolloInterceptor
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.public void dispose()
ApolloInterceptor
A use case for this method call would be when an ApolloCall
needs to be
cancelled and resources need to be disposed of.
dispose
in interface ApolloInterceptor