本文整理汇总了Java中com.google.api.client.googleapis.services.AbstractGoogleClient类的典型用法代码示例。如果您正苦于以下问题:Java AbstractGoogleClient类的具体用法?Java AbstractGoogleClient怎么用?Java AbstractGoogleClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractGoogleClient类属于com.google.api.client.googleapis.services包,在下文中一共展示了AbstractGoogleClient类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateBuilder
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
/**
* Updates the Google client builder to connect the appropriate server based
* on whether LOCAL_ANDROID_RUN is true or false.
*
* @param builder Google client builder
* @return same Google client builder
*/
public static <B extends AbstractGoogleClient.Builder> B updateBuilder(B builder) {
if (LOCAL_ANDROID_RUN) {
builder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL + "/_ah/api/");
}
// only enable GZip when connecting to remote server
final boolean enableGZip = builder.getRootUrl().startsWith("https:");
builder.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
@Override
public void initialize(AbstractGoogleClientRequest<?> request) throws IOException {
if (!enableGZip) {
request.setDisableGZipContent(true);
}
}
});
return builder;
}
示例2: createService
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
protected static <T extends AbstractGoogleClient> T createService(
AbstractGoogleClient.Builder builder) {
String endpoint = System.getenv(ENDPOINT_ENV_VAR);
if (endpoint != null) {
try {
URI u = new URI(endpoint);
if (!u.isAbsolute()) {
throw new IllegalArgumentException("Endpoint URL must be absolute: " + endpoint);
}
builder.setRootUrl(u.resolve("/").toString());
builder.setServicePath(u.getPath());
System.out.println("Using non-standard API endpoint: " + endpoint);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
@SuppressWarnings({"unchecked"})
T built = (T) builder.build();
return built;
}
示例3: updateBuilder
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
/**
* Updates the Google client builder to connect the appropriate server based
* on whether LOCAL_ANDROID_RUN is true or false.
*
* @param builder
* Google client builder
* @return same Google client builder
*/
public static <B extends AbstractGoogleClient.Builder> B updateBuilder(
B builder) {
if (LOCAL_ANDROID_RUN) {
builder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL_FOR_ANDROID
+ "/_ah/api/");
}
// only enable GZip when connecting to remote server
final boolean enableGZip = builder.getRootUrl().startsWith("https:");
builder.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
public void initialize(AbstractGoogleClientRequest<?> request)
throws IOException {
if (!enableGZip) {
request.setDisableGZipContent(true);
}
}
});
return builder;
}
示例4: updateBuilder
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
/**
* Updates the Google client builder to connect the appropriate server based on whether
* LOCAL_ANDROID_RUN is true or false.
*
* @param builder Google client builder
* @return same Google client builder
*/
public static <B extends AbstractGoogleClient.Builder> B updateBuilder(B builder) {
if (LOCAL_ANDROID_RUN) {
builder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL + "/_ah/api/");
}
// only enable GZip when connecting to remote server
final boolean enableGZip = builder.getRootUrl().startsWith("https:");
builder.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
@Override
public void initialize(AbstractGoogleClientRequest<?> request) {
if (!enableGZip) {
request.setDisableGZipContent(true);
}
}
});
return builder;
}
开发者ID:googlearchive,项目名称:solutions-mobile-shopping-assistant-android-client,代码行数:27,代码来源:CloudEndpointBuilderHelper.java
示例5: updateBuilder
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
/**
* Updates the Google client builder to connect the appropriate server based
* on whether LOCAL_ANDROID_RUN is true or false.
*
* @param builder
* Google client builder
* @return same Google client builder
*/
public static <B extends AbstractGoogleClient.Builder> B updateBuilder(B builder) {
if (LOCAL_ANDROID_RUN) {
builder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL + "/_ah/api/");
}
// only enable GZip when connecting to remote server
final boolean enableGZip = builder.getRootUrl().startsWith("https:");
builder.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
public void initialize(AbstractGoogleClientRequest<?> request) throws IOException {
if (!enableGZip) {
request.setDisableGZipContent(true);
}
}
});
return builder;
}
示例6: updateBuilder
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
/**
* Updates the Google client builder to connect the appropriate server based
* on whether LOCAL_ANDROID_RUN is true or false.
*
* @param builder Google client builder
* @return same Google client builder
*/
public static <B extends AbstractGoogleClient.Builder> B updateBuilder(
B builder) {
if (LOCAL_ANDROID_RUN) {
builder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL_FOR_ANDROID
+ "/_ah/api/");
}
// only enable GZip when connecting to remote server
final boolean enableGZip = builder.getRootUrl().startsWith("https:");
builder.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
public void initialize(AbstractGoogleClientRequest<?> request)
throws IOException {
if (!enableGZip) {
request.setDisableGZipContent(true);
}
}
});
return builder;
}
示例7: updateBuilder
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
/**
* Updates the Google client builder to connect the appropriate server based on whether
* LOCAL_ANDROID_RUN is true or false.
*
* @param builder Google client builder
* @return same Google client builder
*/
public static <B extends AbstractGoogleClient.Builder> B updateBuilder(B builder) {
if (LOCAL_ANDROID_RUN) {
builder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL + "/_ah/api/");
}
// only enable GZip when connecting to remote server
final boolean enableGZip = builder.getRootUrl().startsWith("https:");
builder.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
public void initialize(AbstractGoogleClientRequest<?> request) throws IOException {
if (!enableGZip) {
request.setDisableGZipContent(true);
}
}
});
return builder;
}
开发者ID:GoogleCloudPlatform,项目名称:solutions-cloud-adventure-sample-android-client,代码行数:26,代码来源:CloudEndpointUtils.java
示例8: addTraceFor
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
/**
* Creates a {@link GoogleApiTracer} that sets the trace destination on all
* calls that match the given client type.
*/
public GoogleApiTracer addTraceFor(AbstractGoogleClient client, String traceDestination) {
put(client.getClass().getCanonicalName(), traceDestination);
return this;
}
示例9: createService
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
protected <T extends AbstractGoogleClient> T createService(AbstractGoogleClient.Builder builder) {
return BaseWorkflowSample.createService(builder);
}
示例10: Request
import com.google.api.client.googleapis.services.AbstractGoogleClient; //导入依赖的package包/类
/**
* Constructor for a new instance of {@link Request}.
*
* @param abstractGoogleClient Instance of {@link AmbiverseApiClient}
* @param requestMethod The HTTP request method to use, e.g. "GET" or "POST".
* @param uriTemplate The endpoint URL
* @param httpContent The payload to send to the endpoint.
* @param responseClass The model class to deserialize the JSON response to.
*/
protected Request(AbstractGoogleClient abstractGoogleClient, String requestMethod, String uriTemplate,
HttpContent httpContent, Class<T> responseClass) {
super(abstractGoogleClient, requestMethod, uriTemplate, httpContent, responseClass);
// this.setDisableGZipContent(true);
}