【发布时间】:2017-04-13 21:06:40
【问题描述】:
Google Cloud Endpoint 不允许您在调用中拥有多个参数。因此,例如,以下将不起作用
@ApiMethod(name = "addFriend", httpMethod = ApiMethod.HttpMethod.POST)
public void addFriend(Friend frient, User user) throws OAuthRequestException {
...
}
问题是 OAuth 要求我除了通常的参数之外还有一个用户参数。那我该怎么写呢?
【问题讨论】:
-
嗨,这实际上应该可以正常工作。您只能有一个 resource 参数,但用户不应算作资源。你真的尝试过吗?如果是,你得到了什么输出?
-
当我这样做时,整个方法在 android studio 中变为红色(下划线)。留言:
Multiple entity parameters. There can only be a single entity parameter per method. Checks that a specified resource parameter for a class that does not have a transformer is not a multi-level collection or an array and does not use @Named -
我也在使用
import com.google.api.server.spi.auth.common.User -
你使用的是哪个框架版本?
标签: java google-app-engine oauth-2.0 google-cloud-endpoints