Class RateLimitInterceptor
- java.lang.Object
-
- com.contentful.java.cma.interceptor.RateLimitInterceptor
-
- All Implemented Interfaces:
okhttp3.Interceptor
public class RateLimitInterceptor extends java.lang.Object implements okhttp3.InterceptorGet informed when ever a rate limit header is encountered.
-
-
Constructor Summary
Constructors Constructor Description RateLimitInterceptor(RateLimitsListener listener)Create a new ratelimit interceptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description okhttp3.Responseintercept(okhttp3.Interceptor.Chain chain)Intercept a http call.
-
-
-
Constructor Detail
-
RateLimitInterceptor
public RateLimitInterceptor(RateLimitsListener listener)
Create a new ratelimit interceptor.- Parameters:
listener- an object to be informed once a rate limit header is encountered.- Throws:
java.lang.IllegalArgumentException- if listener is null.
-
-
Method Detail
-
intercept
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws java.io.IOExceptionIntercept a http call.- Specified by:
interceptin interfaceokhttp3.Interceptor- Parameters:
chain- the current chain of calls.- Returns:
- a response from this call.
- Throws:
java.io.IOException- if something goes wrong.
-
-