如何在Android的云终点建设者禁用GZipContent [英] How to disable GZipContent in Cloud Endpoints builder in Android

查看:112
本文介绍了如何在Android的云终点建设者禁用GZipContent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用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.

这篇关于如何在Android的云终点建设者禁用GZipContent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆