gpt4 book ai didi

java - 生成端点库时 GAE 中的 DuplicateRestPathException

转载 作者:行者123 更新时间:2023-11-29 03:26:50 24 4
gpt4 key购买 nike

我正在使用 JAVA Google App Engine 构建后端。我创建了 3 个 api 方法,它们都非常相似。

定义如下:

@ApiMethod(name = "getGamesOffThePodium")
public CollectionResponse<MGameResult> getGamesOffThePodium(@Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) {
}

@ApiMethod(name = "getGamesWon")
public CollectionResponse<MGameResult> getGamesWon(@Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) {
}

@ApiMethod(name = "getGamesUnsolved")
public CollectionResponse<MGameResult> getGamesUnsolved(@Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) {
}

这是 Eclipse 在我尝试生成云 enpoint 客户端库时给我的异常:

enter image description here

这是为什么呢?我不能有 3 个方法返回相同对象的集合吗?

最佳答案

您可以让多个对象返回同一个对象。您需要在注释中添加“路径”属性。

@ApiMethod(name = "getGamesOffThePodium", path = "get_games_off_the_podium")
public CollectionResponse<MGameResult> getGamesOffThePodium(@Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) {
}

@ApiMethod(name = "getGamesWon", path = "get_games_won")
public CollectionResponse<MGameResult> getGamesWon(@Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) {
}

@ApiMethod(name = "getGamesUnsolved", path = "get_games_unsolved")
public CollectionResponse<MGameResult> getGamesUnsolved(@Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) {
}

关于java - 生成端点库时 GAE 中的 DuplicateRestPathException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20593026/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com