public class TokenInterceptor extends Object implements okhttp3.Interceptor
Modifier and Type | Field and Description |
---|---|
private static String |
ACCESS_TOKEN_KEY |
private static String |
BAD_ACCESS_TOKEN |
private boolean |
debug |
private static String |
ERROR_CODE_HEADER |
private static String |
INVALID_ACCESS_TOKEN |
private static okhttp3.MediaType |
JSON |
private static okhttp3.MediaType |
JSON_UTF_8 |
private static okhttp3.MediaType |
JSON_UTF8 |
static com.fasterxml.jackson.databind.ObjectMapper |
MAPPER |
private TokenApi |
tokenApi |
private String |
tokenParam |
private static String |
USER_AGENT_HEADER |
Constructor and Description |
---|
TokenInterceptor(TokenApi tokenApi)
Instantiates a new Token interceptor.
|
TokenInterceptor(TokenApi tokenApi,
boolean debug)
Instantiates a new Token interceptor.
|
Modifier and Type | Method and Description |
---|---|
private String |
determineTokenParam(Class<? extends TokenApi> tokenApiClazz) |
private okhttp3.Response |
doRequest(okhttp3.Interceptor.Chain chain) |
okhttp3.Response |
intercept(okhttp3.Interceptor.Chain chain) |
private static final String ACCESS_TOKEN_KEY
private static final String INVALID_ACCESS_TOKEN
private static final String BAD_ACCESS_TOKEN
public static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
private static final okhttp3.MediaType JSON_UTF_8
private static final okhttp3.MediaType JSON_UTF8
private static final okhttp3.MediaType JSON
private static final String ERROR_CODE_HEADER
private static final String USER_AGENT_HEADER
private final TokenApi tokenApi
private final String tokenParam
private final boolean debug
public TokenInterceptor(TokenApi tokenApi)
tokenApi
- the token apipublic TokenInterceptor(TokenApi tokenApi, boolean debug)
tokenApi
- the token apidebug
- the debug@NotNull public final okhttp3.Response intercept(@NotNull okhttp3.Interceptor.Chain chain) throws IOException
intercept
in interface okhttp3.Interceptor
IOException
private okhttp3.Response doRequest(okhttp3.Interceptor.Chain chain) throws IOException
IOException
Copyright © 2025. All rights reserved.