我正在尝试使用来自Android的谷歌云端点Java:
客户端:
Core.Builder coreBuilder = new Core.Builder(
AndroidHttp.newCompatibleTransport(), new GsonFactory(), null);
coreBuilder.setApplicationName("myapp");
if (MainActivity.ENDPOINTS_URL != null) {
coreBuilder.setRootUrl(MainActivity.ENDPOINTS_URL);
coreBuilder.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
public void initialize(AbstractGoogleClientRequest<?> request)
throws IOException {
request.setDisableGZipContent(true);
}
});
}
Core core = coreBuilder.build();
myList = core.asdf("x=&+x", myObject);
服务器:
@ApiMethod(name = "asdf")
public List<String> asdf(@Named("param1") String param1, MyObject myObject) {
if (param1.equals("x=&+x")) {
//should go here, but never does
}
...
虽然它主要起作用,但不知何故param1字符串没有被正确传输,这意味着“x =&amp; + x”以“x =&amp;%2Bx”到达服务器。这是一个已知的错误?或者必须以某种方式手动编码参数?或者这在某种程度上特别适合我的环境?
使用dev环境为java,google api 1.17.0-rc创建SDK V1.8.8。
干杯, 安德烈