我想为Google Cloud Endpoints类禁用GZipContent,以便POST可以在本地开发服务器上运行.
最新的GPE版本生成此端点构建器:
public static final class Builder extends AbstractGoogleJsonClient.Builder { public Builder(HttpTransport transport,JsonFactory jsonFactory,HttpRequestInitializer httpRequestInitializer) { super( transport,jsonFactory,...); }
和谷歌文档建议像这样使用它:
Myendpoint.Builder endpointBuilder = new Myendpoint.Builder( AndroidHttp.newCompatibleTransport(),new GsonFactory(),credential);
有谁知道如何为端点禁用GZipContent?
谢谢.
解决方法
您可以使用:
builder.setGoogleClientRequestInitializer(new TictactoeRequestInitializer() { protected void initializeTictactoeRequest(TictactoeRequest<?> request) { request.setDisableGZipContent(true); } });
将TictactoeRequest替换为适合您的应用程序的类.