【发布时间】:2015-04-10 08:04:39
【问题描述】:
我有请求的结构。
请求 getTransportByStation 完美运行。
但我得到异常java.lang.IllegalArgumentException: TransportWebService.getTransportByRoute: Only one HTTP method is allowed. Found: GET and GET.
我找到了仅适用于 POST 和 POST 的解决方案。
interface TransportWebService {
@GET(QUERY_CATEGORY_TRANSPORT + "GetTransportByNextStation/{station}")
Observable<ResponseRouteList> getTransportByStation(
@Path("city") String city,
@Path("station") String station,
@Query("count") int count,
@Query("userid") String userId
);
@GET(QUERY_CATEGORY_TRANSPORT + "GetTransportByRoute/{route}")
Observable<ResponseRouteList> getTransportByRoute(
@Path("city") String city,
@Path("station") String route,
@Query("count") int count,
@Query("userid") String userId
);
@GET(QUERY_CATEGORY_TRANSPORT + "Time")
Observable<Integer> getTime(
@Path("city") String city
);
}
UPD:改造版本 1.9.0
像这样初始化服务
private static final TransportWebService SERVICE = Common.getRestAdapter()
.setConverter(new GsonConverter(new Gson())
.build()
.create(TransportWebService.class);
【问题讨论】: