我有要求的结构。
要求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);
在第二个GET方法中,第二个参数(@PATH(“ station”))应该是@PATH(“ route”)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句