谷歌云端点EOFException类
我有以下的AppEngine的方法:谷歌云端点EOFException类
@ApiMethod(name = "authed", path = "greeting/authed")
public HelloGreeting authedGreeting(User user) {
...
}
我doInBackground方法在Android中的AsyncTask:
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
只有在调用非auth方法时才起作用。如何解决它?
我正在使用本地服务器。
我在进行插入值的调用时遇到了类似的问题。由于我没有使用身份验证,所以矿区略有不同,但是我得到的是相同的异常。我正在使用appengine-java-sdk-1.8.8。我能够让其他端点调用发生此错误。我查看了生成的代码,以及我在工作调用与非工作调用之间看到的差异,即HttpMethod。失败的呼叫被定义为"POST"
。我可以使用@ApiMethod
批注中的批注属性httpMethod=ApiMethod.HttpMethod.GET
来更改此设置。
@ApiMethod(httpMethod = ApiMethod.HttpMethod.GET, name = "insertUserArtist", path = "insertUserArtist")
我再重新生成客户端代码和我能够拨打电话没有得到可怕的EOFException
。我不知道为什么POST不能正常工作,但将其更改为GET工作。这可能会提出一些问题,可以发送多少数据并且应该解决(可能是图书馆问题)。我将着眼于创建一个演示应用程序以提交给Google。
任何人都有任何想法,为什么这有效? – sauce
如果您传递了“实体”对象,那么POST将起作用。如果您传递的是原始数据类型,那么您将被禁止使用HttpMethod.GET。
如果您正在本地开发服务器上运行,请在MyApi.Builder中添加以下片段,以在设置根网址后正确设置它。
.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
@Override
public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
abstractGoogleClientRequest.setDisableGZipContent(true);
}
})
来源:https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints
这是对本地服务器? –
是的,本地服务器。 –