Cloud Endpoints support for text fields with more than 500 characters

為{幸葍}努か 提交于 2019-12-13 00:36:43

问题


I need to store a field that is usually over 500 characters. When using the String data type, App Engine fails and suggests to use the com.google.appengine.api.datastore.Text datatype in this case.

When doing so, the Android client fails with the following:

AndroidRuntime tag: Caused by: java.lang.IllegalArgumentException: expected primitive class, but got: class com.sample.sampleproj.sampleendpoint.model.Text at com.google.api.client.util.Data.parsePrimitiveValue(Data.java:4 53)

How can string values greater than 500 characters be stored in App Engine and supported by the Cloud Endpoint?


回答1:


There is doccumented limitation to Datastore - 500 characters for String. You can bypass it by using Text (or unindexed String, since Text is deprecated I believe). But this just covers saving/reading data from datastore.

There is undocumented limitation of 500 chars to endpoint method single param. This mean if you send some objct to the method, which after serialization takes more space than 500 chars the method will fail.

I did bypass it by using a servlet. See my question here



来源:https://stackoverflow.com/questions/15935561/cloud-endpoints-support-for-text-fields-with-more-than-500-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!