public class HttpCredentialsAdapter extends Object implements com.google.api.client.http.HttpRequestInitializer, com.google.api.client.http.HttpUnsuccessfulResponseHandler
| Constructor and Description |
|---|
HttpCredentialsAdapter(Credentials credentials) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
handleResponse(com.google.api.client.http.HttpRequest request,
com.google.api.client.http.HttpResponse response,
boolean supportsRetry) |
void |
initialize(com.google.api.client.http.HttpRequest request)
Initialize the HTTP request prior to execution.
|
public HttpCredentialsAdapter(Credentials credentials)
credentials - Credentials instance to adapt for HTTPpublic void initialize(com.google.api.client.http.HttpRequest request)
throws IOException
initialize in interface com.google.api.client.http.HttpRequestInitializerrequest - HTTP requestIOExceptionpublic boolean handleResponse(com.google.api.client.http.HttpRequest request,
com.google.api.client.http.HttpResponse response,
boolean supportsRetry)
Checks if WWW-Authenticate exists and contains a "Bearer" value
(see rfc6750 section 3.1 for more
details). If so, it refreshes the token in case the error code contains
invalid_token. If there is no "Bearer" in WWW-Authenticate and the status code
is HttpStatusCodes.STATUS_CODE_UNAUTHORIZED it refreshes the token. If
the token refresh throws an I/O exception, this implementation will log the
exception and return false.
handleResponse in interface com.google.api.client.http.HttpUnsuccessfulResponseHandlerCopyright © 2019 Google. All rights reserved.