Update Google API dependencies for GData extension (#2754)
* Update Google API dependencies for Sheets & Drive Remove unnecessary direct dependencies which are transitive dependencies of those. * Fix use of deprecated class
This commit is contained in:
parent
1849e62234
commit
d97d6c66b8
@ -126,25 +126,15 @@
|
|||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient</artifactId>
|
||||||
<version>4.5.12</version>
|
<version>4.5.12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.http-client</groupId>
|
|
||||||
<artifactId>google-http-client-jackson</artifactId>
|
|
||||||
<version>1.23.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.oauth-client</groupId>
|
|
||||||
<artifactId>google-oauth-client-jetty</artifactId>
|
|
||||||
<version>1.23.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.apis</groupId>
|
<groupId>com.google.apis</groupId>
|
||||||
<artifactId>google-api-services-drive</artifactId>
|
<artifactId>google-api-services-drive</artifactId>
|
||||||
<version>v3-rev101-1.23.0</version>
|
<version>v3-rev20200413-1.30.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.apis</groupId>
|
<groupId>com.google.apis</groupId>
|
||||||
<artifactId>google-api-services-sheets</artifactId>
|
<artifactId>google-api-services-sheets</artifactId>
|
||||||
<version>v4-rev502-1.23.0</version>
|
<version>v4-rev20200508-1.30.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
@ -152,7 +142,6 @@
|
|||||||
<version>${jackson.version}</version>
|
<version>${jackson.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testng</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>testng</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
|
@ -13,14 +13,14 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl;
|
import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl;
|
||||||
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
|
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
|
||||||
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
|
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
|
||||||
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
|
import com.google.api.client.auth.oauth2.Credential;
|
||||||
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
|
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
|
||||||
import com.google.api.client.http.HttpRequest;
|
import com.google.api.client.http.HttpRequest;
|
||||||
import com.google.api.client.http.HttpRequestInitializer;
|
import com.google.api.client.http.HttpRequestInitializer;
|
||||||
import com.google.api.client.http.HttpTransport;
|
import com.google.api.client.http.HttpTransport;
|
||||||
import com.google.api.client.http.javanet.NetHttpTransport;
|
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||||
import com.google.api.client.json.JsonFactory;
|
import com.google.api.client.json.JsonFactory;
|
||||||
import com.google.api.client.json.jackson.JacksonFactory;
|
import com.google.api.client.json.jackson2.JacksonFactory;
|
||||||
import com.google.api.services.drive.Drive;
|
import com.google.api.services.drive.Drive;
|
||||||
import com.google.api.services.drive.DriveScopes;
|
import com.google.api.services.drive.DriveScopes;
|
||||||
import com.google.api.services.sheets.v4.Sheets;
|
import com.google.api.services.sheets.v4.Sheets;
|
||||||
@ -110,8 +110,8 @@ abstract public class GoogleAPIExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static public Drive getDriveService(String token) {
|
static public Drive getDriveService(String token) {
|
||||||
GoogleCredential credential = new GoogleCredential().setAccessToken(token);
|
Credential credential = new Credential.Builder(null).build().setAccessToken(token);
|
||||||
|
|
||||||
return new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setHttpRequestInitializer(new HttpRequestInitializer() {
|
return new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setHttpRequestInitializer(new HttpRequestInitializer() {
|
||||||
@Override
|
@Override
|
||||||
public void initialize(HttpRequest httpRequest) throws IOException {
|
public void initialize(HttpRequest httpRequest) throws IOException {
|
||||||
@ -156,7 +156,7 @@ abstract public class GoogleAPIExtension {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static Sheets getSheetsService(String token) throws IOException {
|
public static Sheets getSheetsService(String token) throws IOException {
|
||||||
GoogleCredential credential = new GoogleCredential().setAccessToken(token);
|
Credential credential = new Credential.Builder(null).build().setAccessToken(token);
|
||||||
int connectTimeout = getConnectTimeout();
|
int connectTimeout = getConnectTimeout();
|
||||||
int readTimeout = getReadTimeout();
|
int readTimeout = getReadTimeout();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user