Java Google云端点EOFEException

Java Google云端点EOFEException,java,android,google-app-engine,gzip,google-cloud-endpoints,Java,Android,Google App Engine,Gzip,Google Cloud Endpoints,我在AppEngine中有以下方法: @ApiMethod(name = "authed", path = "greeting/authed") public HelloGreeting authedGreeting(User user) { ... } Android AsyncTask中的My doInBackground方法: HelloGreeting hg = null; try { hg = service.authed().execute(); } catch (

我在AppEngine中有以下方法:

@ApiMethod(name = "authed", path = "greeting/authed")
public HelloGreeting authedGreeting(User user) {
    ...
}
Android AsyncTask中的My doInBackground方法:

HelloGreeting hg = null;
try {
    hg = service.authed().execute();
} catch (IOException e) {
    Log.d("error", e.getMessage(), e);
}
return hg;
我遇到了ff错误:

/_ah/api/.../v1/greeting/authed: java.io.EOFException
在logcat中:

Problem accessing /_ah/api/.../v1/greeting/authed. Reason: INTERNAL_SERVER_ERROR
    at java.util.zip.GZIPInputStream.readUByte
    at java.util.zip.GZIPInputStream.readUShort
    at java.util.zip.GZIPInputStream.readUShort
它仅在调用非身份验证方法时起作用。如何修复它


我正在使用本地服务器。

我在调用插入值时遇到了类似的问题。我的略有不同,因为我没有使用身份验证,但是我得到了相同的异常。我正在使用appengine-java-sdk-1.8.8。有此错误时,我可以进行其他端点调用。我查看了生成的代码,发现工作调用与非工作调用的区别在于HttpMethod。失败的调用被定义为
“POST”
。我可以使用
@ApiMethod
注释中的注释属性
httpMethod=ApiMethod.httpMethod.GET
来更改此设置

@ApiMethod(httpMethod = ApiMethod.HttpMethod.GET, name = "insertUserArtist", path = "insertUserArtist")

然后,我重新生成了客户端代码,并且我能够在没有收到可怕的
EOFException
的情况下进行调用。我不知道为什么这篇文章不能正常工作,但我把它改成了工作。这可能会提出一些问题,即可以跨多大范围发送数据,并且应该解决多少数据(可能是库问题)。我将研究创建一个演示应用程序,提交给谷歌。

如果您传递了一个“实体”对象,那么帖子将起作用。如果要传递基本数据类型,则必须使用HttpMethod.GET。

如果在本地开发服务器上运行, 然后在MyApi.Builder中添加以下代码段,以便在设置根url后正确设置它

    .setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
                @Override
                public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
                    abstractGoogleClientRequest.setDisableGZipContent(true);
                }
            })
.setGoogleClientRequestInitializer(新的GoogleClientRequestInitializer(){
@凌驾
public void initialize(AbstractGoogleClientRequest AbstractGoogleClientRequest)引发IOException{
abstractGoogleClientRequest.setDisablegzip内容(true);
}
})

来源:

这是针对本地服务器的吗?