如何在Android的云终点建设者禁用GZipContent建设者、终点、如何在、GZipContent

由网友(别将过去抱得太紧)分享简介:我想禁用GZipContent了谷歌云端点类,这样一个帖子可以在本地开发服务器上运行。I want to disable GZipContent for a Google Cloud Endpoints class so that a POST can work on the local development se...

我想禁用GZipContent了谷歌云端点类,这样一个帖子可以在本地开发服务器上运行。

I want to disable GZipContent for a Google Cloud Endpoints class so that a POST can work on the local development server.

最新GPE版本生成此终端制造商:

The latest GPE release generates this endpoint builder:

public static final class Builder extends AbstractGoogleJsonClient.Builder {
    public Builder(HttpTransport transport, JsonFactory jsonFactory,
        HttpRequestInitializer httpRequestInitializer) {
      super(
          transport,
          jsonFactory,
          ...);
    }

和谷歌文档,建议使用这样的:

and Google documentation recommends using it like this:

Myendpoint.Builder endpointBuilder = new Myendpoint.Builder(
                    AndroidHttp.newCompatibleTransport(),
                    new GsonFactory(),
                    credential);

有谁知道如何禁用GZipContent端点?

Does anyone know how to disable GZipContent for the endpoint?

感谢。

推荐答案

您可以使用:

builder.setGoogleClientRequestInitializer(new TictactoeRequestInitializer() {
     protected void initializeTictactoeRequest(TictactoeRequest<?> request) {
         request.setDisableGZipContent(true);
     }
   });

替换 TictactoeRequest 与适当类应用程序。

Replace TictactoeRequest with the appropriate class for your application.

阅读全文

相关推荐

最新文章