本文整理了Java中com.google.api.client.googleapis.util.Utils.getDefaultTransport()
方法的一些代码示例,展示了Utils.getDefaultTransport()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getDefaultTransport()
方法的具体详情如下:
包路径:com.google.api.client.googleapis.util.Utils
类名称:Utils
方法名:getDefaultTransport
[英]Returns a cached default implementation of the HttpTransport interface.
[中]返回HttpTransport接口的缓存默认实现。
代码示例来源:origin: GoogleCloudPlatform/java-docs-samples
/**
* Create a Storage Transfer client using application default credentials and other default
* settings.
*
* @return a Storage Transfer client
* @throws IOException
* there was an error obtaining application default credentials
*/
public static Storagetransfer createStorageTransferClient() throws IOException {
HttpTransport httpTransport = Utils.getDefaultTransport();
JsonFactory jsonFactory = Utils.getDefaultJsonFactory();
GoogleCredential credential =
GoogleCredential.getApplicationDefault(httpTransport, jsonFactory);
return createStorageTransferClient(httpTransport, jsonFactory, credential);
}
代码示例来源:origin: googlegenomics/dataflow-java
@Override
public HttpTransport create(PipelineOptions options) {
return Utils.getDefaultTransport();
}
}
代码示例来源:origin: com.google.cloud.genomics/google-genomics-dataflow
@Override
public HttpTransport create(PipelineOptions options) {
return Utils.getDefaultTransport();
}
}
代码示例来源:origin: spotify/styx
public static GoogleIdTokenAuth of(GoogleCredential credential) {
return of(Utils.getDefaultTransport(), Optional.of(credential));
}
代码示例来源:origin: spotify/styx
public static GoogleIdTokenAuth of(Optional<GoogleCredential> credential) {
return of(Utils.getDefaultTransport(), credential);
}
代码示例来源:origin: XeroAPI/Xero-Java
public ApiClient(
String basePath,
HttpTransport httpTransport,
HttpRequestInitializer initializer,
ObjectMapper objectMapper
) {
this.basePath = basePath == null ? defaultBasePath : (
basePath.endsWith("/") ? basePath.substring(0, basePath.length() - 1) : basePath
);
this.httpRequestFactory = (httpTransport == null ? Utils.getDefaultTransport() : httpTransport).createRequestFactory(initializer);
this.objectMapper = (objectMapper == null ? createDefaultObjectMapper() : objectMapper);
}
代码示例来源:origin: spotify/async-google-pubsub-client
private static Credential defaultCredential() {
try {
return GoogleCredential.getApplicationDefault(
Utils.getDefaultTransport(), Utils.getDefaultJsonFactory());
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
代码示例来源:origin: org.apache.beam/beam-examples-java
/** Builds a new Pubsub client with default HttpTransport and JsonFactory and returns it. */
public static Pubsub getClient() throws IOException {
return getClient(Utils.getDefaultTransport(), Utils.getDefaultJsonFactory());
}
代码示例来源:origin: GoogleCloudPlatform/cloud-pubsub-samples-java
/**
* Builds a new Pubsub client with default HttpTransport and
* JsonFactory and returns it.
*
* @return Pubsub client.
* @throws IOException when we can not get the default credentials.
*/
public static Pubsub getClient() throws IOException {
return getClient(Utils.getDefaultTransport(),
Utils.getDefaultJsonFactory());
}
代码示例来源:origin: com.google.api-client/google-api-client
/**
* {@link Beta} <br/>
* Return a credential defined by a Json file.
*
* @param credentialStream the stream with the credential definition.
* @return the credential defined by the credentialStream.
* @throws IOException if the credential cannot be created from the stream.
*/
@Beta
public static GoogleCredential fromStream(InputStream credentialStream) throws IOException {
return fromStream(
credentialStream,
Utils.getDefaultTransport(),
Utils.getDefaultJsonFactory());
}
代码示例来源:origin: com.google.api-client/google-api-client
/**
* {@link Beta} <br/>
* Returns the Application Default Credentials.
*
* <p>Returns the Application Default Credentials which are credentials that identify and
* authorize the whole application. This is the built-in service account if running on Google
* Compute Engine or the credentials file from the path in the environment variable
* GOOGLE_APPLICATION_CREDENTIALS.</p>
*
* @return the credential instance.
* @throws IOException if the credential cannot be created in the current environment.
*/
@Beta
public static GoogleCredential getApplicationDefault() throws IOException {
return getApplicationDefault(Utils.getDefaultTransport(), Utils.getDefaultJsonFactory());
}
代码示例来源:origin: com.google.cloud.genomics/google-genomics-utils
private HttpTransport httpTransport = Utils.getDefaultTransport();
private int connectTimeout = DEFAULT_CONNECT_TIMEOUT;
private int readTimeout = DEFAULT_READ_TIMEOUT;
内容来源于网络,如有侵权,请联系作者删除!